Skip to content

Commit

Permalink
fix: Fix renderContentAsset based on Github Issue suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
golmansax committed Apr 20, 2020
1 parent 1ffc393 commit 0007398
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/index.js
Expand Up @@ -408,7 +408,24 @@ class MiniCssExtractPlugin {
return obj;
}

// This very awful workaround prevents a weird `<undefined>.pop()` in the plugin
// that's caused by who-knows-what (NOT related to dynamic imports).
// See this github issue for details:
// https://github.com/webpack-contrib/mini-css-extract-plugin/issues/257
renderContentAsset(compilation, chunk, modules, requestShortener) {
const [chunkGroup] = chunk.groupsIterable;
let rv;
const getModuleIndex2 = chunkGroup.getModuleIndex2;
try {
chunkGroup.getModuleIndex2 = null;
rv = this.originalRenderContentAsset(compilation, chunk, modules, requestShortener);
} finally {
chunkGroup.getModuleIndex2 = getModuleIndex2;
}
return rv;
}

originalRenderContentAsset(compilation, chunk, modules, requestShortener) {
let usedModules;

const [chunkGroup] = chunk.groupsIterable;
Expand Down

0 comments on commit 0007398

Please sign in to comment.