Skip to content

Commit 0820967

Browse files
committed
webpack3 support
1 parent b463530 commit 0820967

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

index.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const getRelativePath = (filePath) => {
1010
}
1111

1212
const emitHandle = (compilation, callback) => {
13-
compilation.entrypoints.forEach(({chunks}) => {
13+
function chunksHandle(chunks) {
1414
const entryChunk = chunks.pop()
1515

1616
entryChunk.files.forEach(filePath => {
@@ -39,7 +39,17 @@ const emitHandle = (compilation, callback) => {
3939
assetFile.source = () => content
4040
})
4141
})
42-
})
42+
}
43+
44+
if(compilation.entrypoints instanceof Map) {
45+
compilation.entrypoints.forEach(({chunks}) => chunksHandle(chunks))
46+
}else {
47+
Object.keys(compilation.entrypoints).forEach(key => {
48+
const { chunks } = compilation.entrypoints[key]
49+
chunksHandle(chunks)
50+
})
51+
}
52+
4353
callback()
4454
}
4555

0 commit comments

Comments
 (0)