Skip to content

Commit c7eda97

Browse files
laysentevilebottnawi
authored andcommitted
refactor: only output when any chunk is fulfilled (#468)
1 parent 357d073 commit c7eda97

File tree

12 files changed

+104
-2
lines changed

12 files changed

+104
-2
lines changed

src/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,11 @@ class MiniCssExtractPlugin {
514514
return [
515515
` * ${m.readableIdentifier(requestShortener)}`,
516516
` - couldn't fulfill desired order of chunk group(s) ${failedChunkGroups}`,
517-
` - while fulfilling desired order of chunk group(s) ${goodChunkGroups}`,
518-
].join('\n');
517+
goodChunkGroups &&
518+
` - while fulfilling desired order of chunk group(s) ${goodChunkGroups}`,
519+
]
520+
.filter(Boolean)
521+
.join('\n');
519522
}),
520523
].join('\n')
521524
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
content: 'e1';
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
content: 'e2';
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
content: 'e3';
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
content: 'e4';
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
body {
2+
content: 'e1';
3+
}
4+
5+
body {
6+
content: 'e4';
7+
}
8+
9+
body {
10+
content: 'e2';
11+
}
12+
13+
body {
14+
content: 'e3';
15+
}
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './e1.css';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import './e2.css';
2+
import './e1.css';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './e3.css';
2+
import './e4.css';
3+
import './e2.css';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './e4.css';
2+
import './e2.css';
3+
import './e3.css';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const cssLoaderPath = require.resolve('css-loader').replace(/\\/g, '/');
2+
3+
module.exports = [
4+
'',
5+
'WARNING in chunk styles [mini-css-extract-plugin]',
6+
'Conflicting order. Following module has been added:',
7+
` * css ${cssLoaderPath}!./e1.css`,
8+
'despite it was not able to fulfill desired ordering with these modules:',
9+
` * css ${cssLoaderPath}!./e2.css`,
10+
" - couldn't fulfill desired order of chunk group(s) entry2",
11+
'',
12+
'WARNING in chunk styles [mini-css-extract-plugin]',
13+
'Conflicting order. Following module has been added:',
14+
` * css ${cssLoaderPath}!./e4.css`,
15+
'despite it was not able to fulfill desired ordering with these modules:',
16+
` * css ${cssLoaderPath}!./e3.css`,
17+
" - couldn't fulfill desired order of chunk group(s) entry3",
18+
' - while fulfilling desired order of chunk group(s) entry4',
19+
'',
20+
'WARNING in chunk styles [mini-css-extract-plugin]',
21+
'Conflicting order. Following module has been added:',
22+
` * css ${cssLoaderPath}!./e2.css`,
23+
'despite it was not able to fulfill desired ordering with these modules:',
24+
` * css ${cssLoaderPath}!./e3.css`,
25+
" - couldn't fulfill desired order of chunk group(s) entry3",
26+
' - while fulfilling desired order of chunk group(s) entry4',
27+
].join('\n');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import Self from '../../../src';
2+
3+
module.exports = {
4+
entry: {
5+
entry1: './index.js',
6+
entry2: './index2.js',
7+
entry3: './index3.js',
8+
entry4: './index4.js',
9+
},
10+
module: {
11+
rules: [
12+
{
13+
test: /\.css$/,
14+
use: [Self.loader, 'css-loader'],
15+
},
16+
],
17+
},
18+
optimization: {
19+
splitChunks: {
20+
cacheGroups: {
21+
styles: {
22+
name: 'styles',
23+
chunks: 'all',
24+
test: /\.css$/,
25+
enforce: true,
26+
},
27+
},
28+
},
29+
},
30+
plugins: [
31+
new Self({
32+
ignoreOrder: false,
33+
}),
34+
],
35+
};

0 commit comments

Comments
 (0)