mirror of https://github.com/webpack/webpack.git
fix: crash with importModule when CSS enabled
This commit is contained in:
parent
1018ca80b3
commit
1f8637ce0b
|
|
@ -302,12 +302,20 @@ class CssModulesPlugin {
|
|||
}
|
||||
return result;
|
||||
});
|
||||
const enabledChunks = new WeakSet();
|
||||
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
||||
const isEnabledForChunk = chunk => {
|
||||
const options = chunk.getEntryOptions();
|
||||
const chunkLoading =
|
||||
options && options.chunkLoading !== undefined
|
||||
? options.chunkLoading
|
||||
: globalChunkLoading;
|
||||
return chunkLoading === "jsonp";
|
||||
};
|
||||
const onceForChunkSet = new WeakSet();
|
||||
const handler = (chunk, set) => {
|
||||
if (enabledChunks.has(chunk)) {
|
||||
return;
|
||||
}
|
||||
enabledChunks.add(chunk);
|
||||
if (onceForChunkSet.has(chunk)) return;
|
||||
onceForChunkSet.add(chunk);
|
||||
if (!isEnabledForChunk(chunk)) return;
|
||||
|
||||
set.add(RuntimeGlobals.publicPath);
|
||||
set.add(RuntimeGlobals.getChunkCssFilename);
|
||||
|
|
|
|||
Loading…
Reference in New Issue