Skip to content

Commit 639e825

Browse files
committed
Fix: Do not use syntax not supported in Node 4
Fix #268
1 parent 79374a0 commit 639e825

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

loaders/styleguide.loader.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,16 @@ function processSectionsList(sections, config) {
183183
* @returns {Array}
184184
*/
185185
function flattenComponentFiles(componentFiles, sectionsWithFiles) {
186-
const getFilesFromSection = ({ sections = [], componentFiles }) => ([
187-
componentFiles,
188-
sections.map(getFilesFromSection),
189-
]);
190-
191-
return flatMapDeep([
192-
...componentFiles,
193-
sectionsWithFiles.map(getFilesFromSection),
194-
]);
186+
const getFilesFromSection = section => {
187+
return [
188+
section.componentFiles,
189+
(section.sections || []).map(getFilesFromSection),
190+
];
191+
};
192+
193+
return flatMapDeep(
194+
componentFiles.concat(sectionsWithFiles.map(getFilesFromSection))
195+
);
195196
}
196197

197198
module.exports = function() {};
@@ -217,6 +218,8 @@ module.exports.pitch = function() {
217218
config.contextDependencies.forEach(d => this.addContextDependency(d));
218219
}
219220
else {
221+
// Add common parent folder for all components as a context dependency to enable
222+
// hot reload when you create a file
220223
const allComponentFiles = flattenComponentFiles(componentFiles, sectionsWithFiles);
221224
if (allComponentFiles.length) {
222225
const contextDir = commonDir(allComponentFiles);

0 commit comments

Comments
 (0)