Skip to content

Commit b9376da

Browse files
test: fix
1 parent 5b8ab7e commit b9376da

File tree

6 files changed

+6
-11
lines changed

6 files changed

+6
-11
lines changed

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ class MiniCssExtractPlugin {
479479
`${webpack.RuntimeGlobals.require}.miniCssF`,
480480
(referencedChunk) => {
481481
if (!referencedChunk.contentHash[MODULE_TYPE]) {
482-
return '';
482+
return false;
483483
}
484484

485485
return referencedChunk.canBeInitial()

test/cases/hmr/expected/webpack-5/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ module.exports = function (urlString) {
358358
/******/ // This function allow to reference all chunks
359359
/******/ __webpack_require__.miniCssF = (chunkId) => {
360360
/******/ // return url for filenames based on template
361-
/******/ return "" + "main" + ".css";
361+
/******/ return undefined;
362362
/******/ };
363363
/******/ })();
364364
/******/

test/cases/hmr/webpack.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Self from '../../../src';
44

55
module.exports = {
66
entry: './index.css',
7+
mode: 'development',
78
module: {
89
rules: [
910
{

test/cases/insert-function/expected/webpack-5/main.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@
5454
/******/ (() => {
5555
/******/ // This function allow to reference all chunks
5656
/******/ __webpack_require__.miniCssF = (chunkId) => {
57-
/******/ // return url for filenames not based on template
58-
/******/ if (chunkId === 1) return "1.css";
5957
/******/ // return url for filenames based on template
60-
/******/ return "" + "main" + ".css";
58+
/******/ return "" + chunkId + ".css";
6159
/******/ };
6260
/******/ })();
6361
/******/

test/cases/insert-string/expected/webpack-5/main.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@
5454
/******/ (() => {
5555
/******/ // This function allow to reference all chunks
5656
/******/ __webpack_require__.miniCssF = (chunkId) => {
57-
/******/ // return url for filenames not based on template
58-
/******/ if (chunkId === 1) return "1.css";
5957
/******/ // return url for filenames based on template
60-
/******/ return "" + "main" + ".css";
58+
/******/ return "" + chunkId + ".css";
6159
/******/ };
6260
/******/ })();
6361
/******/

test/cases/insert-undefined/expected/webpack-5/main.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@
5454
/******/ (() => {
5555
/******/ // This function allow to reference all chunks
5656
/******/ __webpack_require__.miniCssF = (chunkId) => {
57-
/******/ // return url for filenames not based on template
58-
/******/ if (chunkId === 1) return "1.css";
5957
/******/ // return url for filenames based on template
60-
/******/ return "" + "main" + ".css";
58+
/******/ return "" + chunkId + ".css";
6159
/******/ };
6260
/******/ })();
6361
/******/

0 commit comments

Comments
 (0)