Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,30 @@ 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 {
rv = this.originalRenderContentAsset(compilation, chunk, modules, requestShortener);
}
catch(e) {
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