Skip to content

Commit dd32166

Browse files
mikegreilingSpaceK33z
authored andcommittedFeb 26, 2018
Fix support for DynamicEntryPlugin (#1319)
1 parent ab4eeb0 commit dd32166

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed
 

‎lib/util/addDevServerEntrypoints.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,22 @@ module.exports = function addDevServerEntrypoints(webpackOptions, devServerOptio
1919

2020
if (devServerOptions.hotOnly) { devClient.push('webpack/hot/only-dev-server'); } else if (devServerOptions.hot) { devClient.push('webpack/hot/dev-server'); }
2121

22-
[].concat(webpackOptions).forEach((wpOpt) => {
23-
if (typeof wpOpt.entry === 'object' && !Array.isArray(wpOpt.entry)) {
24-
Object.keys(wpOpt.entry).forEach((key) => {
25-
wpOpt.entry[key] = devClient.concat(wpOpt.entry[key]);
22+
const prependDevClient = (entry) => {
23+
if (typeof entry === 'function') {
24+
return () => Promise.resolve(entry()).then(prependDevClient);
25+
}
26+
if (typeof entry === 'object' && !Array.isArray(entry)) {
27+
const entryClone = {};
28+
Object.keys(entry).forEach((key) => {
29+
entryClone[key] = devClient.concat(entry[key]);
2630
});
27-
} else if (typeof wpOpt.entry === 'function') {
28-
wpOpt.entry = wpOpt.entry(devClient);
29-
} else {
30-
wpOpt.entry = devClient.concat(wpOpt.entry);
31+
return entryClone;
3132
}
33+
return devClient.concat(entry);
34+
};
35+
36+
[].concat(webpackOptions).forEach((wpOpt) => {
37+
wpOpt.entry = prependDevClient(wpOpt.entry);
3238
});
3339
}
3440
};

0 commit comments

Comments
 (0)
Please sign in to comment.