Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: bloated runtime
  • Loading branch information
alexander-akait committed Jan 27, 2021
commit 5b8ab7ed744be8f105dac29e66c81186962daf8b
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,15 @@ class MiniCssExtractPlugin {
MODULE_TYPE,
'mini-css',
`${webpack.RuntimeGlobals.require}.miniCssF`,
(referencedChunk) =>
referencedChunk.canBeInitial()
(referencedChunk) => {
if (!referencedChunk.contentHash[MODULE_TYPE]) {
return '';
}

return referencedChunk.canBeInitial()
? this.options.filename
: this.options.chunkFilename,
: this.options.chunkFilename;
},
true
)
);
Expand Down
2 changes: 1 addition & 1 deletion test/cases/runtime/expected/webpack-5/runtime~main.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/******/ // This function allow to reference all chunks
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + ({"0":"main","1":"runtime~main"}[chunkId] || chunkId) + "." + {"0":"a7263f8f763dcf4051bc"}[chunkId] + ".css";
/******/ return "" + "main" + "." + "a7263f8f763dcf4051bc" + ".css";
/******/ };
/******/ })();
/******/
Expand Down