Skip to content

Commit 57ad127

Browse files
fix: crash with [contenthash] (#869)
1 parent b4be280 commit 57ad127

File tree

20 files changed

+96
-40
lines changed

20 files changed

+96
-40
lines changed

src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,7 @@ class MiniCssExtractPlugin {
821821
return referencedChunk.canBeInitial()
822822
? this.options.filename
823823
: this.options.chunkFilename;
824-
},
825-
true
824+
}
826825
)
827826
);
828827

test/TestCases.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe("TestCases", () => {
114114
Object.assign(
115115
config,
116116
{
117-
mode: "none",
117+
mode: config.mode || "none",
118118
context: directoryForCase,
119119
},
120120
config,

test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,16 @@ __webpack_require__.r(__webpack_exports__);
6464
/******/
6565
/******/ /* webpack/runtime/get mini-css chunk filename */
6666
/******/ (() => {
67-
/******/ // This function allow to reference all chunks
67+
/******/ // This function allow to reference async chunks
6868
/******/ __webpack_require__.miniCssF = (chunkId) => {
69-
/******/ // return url for filenames not based on template
70-
/******/ if (chunkId === 1) return "" + __webpack_require__.h() + ".css";
7169
/******/ // return url for filenames based on template
7270
/******/ return "" + chunkId + "." + __webpack_require__.h() + ".css";
7371
/******/ };
7472
/******/ })();
7573
/******/
7674
/******/ /* webpack/runtime/getFullHash */
7775
/******/ (() => {
78-
/******/ __webpack_require__.h = () => ("b39c6cd65ee4f78b425e")
76+
/******/ __webpack_require__.h = () => ("28af1b92f2511f8f1836")
7977
/******/ })();
8078
/******/
8179
/******/ /* webpack/runtime/global */

test/cases/chunkFilename-fullhash/expected/webpack-5/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,16 @@ __webpack_require__.r(__webpack_exports__);
6464
/******/
6565
/******/ /* webpack/runtime/get mini-css chunk filename */
6666
/******/ (() => {
67-
/******/ // This function allow to reference all chunks
67+
/******/ // This function allow to reference async chunks
6868
/******/ __webpack_require__.miniCssF = (chunkId) => {
69-
/******/ // return url for filenames not based on template
70-
/******/ if (chunkId === 1) return "" + __webpack_require__.h() + ".css";
7169
/******/ // return url for filenames based on template
7270
/******/ return "" + chunkId + "." + __webpack_require__.h() + ".css";
7371
/******/ };
7472
/******/ })();
7573
/******/
7674
/******/ /* webpack/runtime/getFullHash */
7775
/******/ (() => {
78-
/******/ __webpack_require__.h = () => ("4119f46f7fa72336b928")
76+
/******/ __webpack_require__.h = () => ("845a2495b51038b0d047")
7977
/******/ })();
8078
/******/
8179
/******/ /* webpack/runtime/global */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/cases/contenthash-1/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint-disable */
2+
async () => await import("./lib.js");
3+
import "./style.css";

0 commit comments

Comments
 (0)