Skip to content

Commit b67771c

Browse files
committed
fix: webpack 3 compat
1 parent e8c395c commit b67771c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib/extract-chunks.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
const Entrypoint = require('webpack/lib/Entrypoint');
19-
2018
function isAsync(chunk) {
2119
if ('canBeInitial' in chunk) {
2220
return !chunk.canBeInitial();
@@ -26,10 +24,15 @@ function isAsync(chunk) {
2624
}
2725

2826
function getChunkEntryNames(chunk) {
29-
return Array.from(new Set(getNames(chunk.groupsIterable)));
27+
if ('groupsIterable' in chunk) {
28+
return Array.from(new Set(getNames(chunk.groupsIterable)));
29+
} else {
30+
return chunk.entrypoints.map(e => e.options.name);
31+
}
3032
}
3133

3234
function getNames(groups) {
35+
const Entrypoint = require('webpack/lib/Entrypoint');
3336
const names = [];
3437
for (const group of groups) {
3538
if (group instanceof Entrypoint) {

0 commit comments

Comments
 (0)