Skip to content

Commit 44f4211

Browse files
committed
fix: Fix renderContentAsset based on Github Issue suggestion
webpack-contrib#257
1 parent 50434b5 commit 44f4211

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: src/index.js

+17
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,24 @@ class MiniCssExtractPlugin {
408408
return obj;
409409
}
410410

411+
// This very awful workaround prevents a weird `<undefined>.pop()` in the plugin
412+
// that's caused by who-knows-what (NOT related to dynamic imports).
413+
// See this github issue for details:
414+
// https://github.com/webpack-contrib/mini-css-extract-plugin/issues/257
411415
renderContentAsset(compilation, chunk, modules, requestShortener) {
416+
const [chunkGroup] = chunk.groupsIterable;
417+
let rv;
418+
const getModuleIndex2 = chunkGroup.getModuleIndex2;
419+
try {
420+
chunkGroup.getModuleIndex2 = null;
421+
rv = this.originalRenderContentAsset(compilation, chunk, modules, requestShortener);
422+
} finally {
423+
chunkGroup.getModuleIndex2 = getModuleIndex2;
424+
}
425+
return rv;
426+
}
427+
428+
originalRenderContentAsset(compilation, chunk, modules, requestShortener) {
412429
let usedModules;
413430

414431
const [chunkGroup] = chunk.groupsIterable;

0 commit comments

Comments
 (0)