Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only output when any chunk is fulfilled #468

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,11 @@ class MiniCssExtractPlugin {
return [
` * ${m.readableIdentifier(requestShortener)}`,
` - couldn't fulfill desired order of chunk group(s) ${failedChunkGroups}`,
` - while fulfilling desired order of chunk group(s) ${goodChunkGroups}`,
].join('\n');
goodChunkGroups &&
` - while fulfilling desired order of chunk group(s) ${goodChunkGroups}`,
]
.filter(Boolean)
.join('\n');
}),
].join('\n')
)
Expand Down
3 changes: 3 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/e1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
content: 'e1';
}
3 changes: 3 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/e2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
content: 'e2';
}
3 changes: 3 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/e3.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
content: 'e3';
}
3 changes: 3 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/e4.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
content: 'e4';
}
16 changes: 16 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/expected/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
body {
content: 'e1';
}

body {
content: 'e4';
}

body {
content: 'e2';
}

body {
content: 'e3';
}

1 change: 1 addition & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './e1.css';
2 changes: 2 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/index2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './e2.css';
import './e1.css';
3 changes: 3 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/index3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './e3.css';
import './e4.css';
import './e2.css';
3 changes: 3 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/index4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './e4.css';
import './e2.css';
import './e3.css';
27 changes: 27 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/warnings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const cssLoaderPath = require.resolve('css-loader').replace(/\\/g, '/');

module.exports = [
'',
'WARNING in chunk styles [mini-css-extract-plugin]',
'Conflicting order. Following module has been added:',
` * css ${cssLoaderPath}!./e1.css`,
'despite it was not able to fulfill desired ordering with these modules:',
` * css ${cssLoaderPath}!./e2.css`,
" - couldn't fulfill desired order of chunk group(s) entry2",
'',
'WARNING in chunk styles [mini-css-extract-plugin]',
'Conflicting order. Following module has been added:',
` * css ${cssLoaderPath}!./e4.css`,
'despite it was not able to fulfill desired ordering with these modules:',
` * css ${cssLoaderPath}!./e3.css`,
" - couldn't fulfill desired order of chunk group(s) entry3",
' - while fulfilling desired order of chunk group(s) entry4',
'',
'WARNING in chunk styles [mini-css-extract-plugin]',
'Conflicting order. Following module has been added:',
` * css ${cssLoaderPath}!./e2.css`,
'despite it was not able to fulfill desired ordering with these modules:',
` * css ${cssLoaderPath}!./e3.css`,
" - couldn't fulfill desired order of chunk group(s) entry3",
' - while fulfilling desired order of chunk group(s) entry4',
].join('\n');
35 changes: 35 additions & 0 deletions test/cases/ignoreOrderFalseWithoutGoodChunks/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Self from '../../../src';

module.exports = {
entry: {
entry1: './index.js',
entry2: './index2.js',
entry3: './index3.js',
entry4: './index4.js',
},
module: {
rules: [
{
test: /\.css$/,
use: [Self.loader, 'css-loader'],
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
styles: {
name: 'styles',
chunks: 'all',
test: /\.css$/,
enforce: true,
},
},
},
},
plugins: [
new Self({
ignoreOrder: false,
}),
],
};