Skip to content

Commit 7f4159e

Browse files
docs: updating docs about filtering warnings warningsFilter
1 parent 15dd658 commit 7f4159e

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ module.exports = {
228228
plugins: [
229229
new MiniCssExtractPlugin({
230230
filename: "[name].css",
231-
chunkFilename: "[id].css",
232-
// disables order warnings being logged in terminal after build
233-
orderWarning: true, // Disable to remove warnings about conflicting order between imports
231+
chunkFilename: "[id].css"
234232
})
235233
],
236234
module: {
@@ -364,6 +362,10 @@ module.exports = {
364362

365363
For long term caching use `filename: "[contenthash].css"`. Optionally add `[name]`.
366364

365+
### Remove Order Warnings
366+
367+
If the terminal is getting bloated with chunk order warnings. You can filter by configuring [warningsFilter](https://webpack.js.org/configuration/stats/) withing the webpack stats option
368+
367369
### Media Query Plugin
368370

369371
If you'd like to extract the media queries from the extracted CSS (so mobile users don't need to load desktop or tablet specific CSS anymore) you should use one of the following plugins:

src/index.js

+10-15
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ class MiniCssExtractPlugin {
113113
this.options = Object.assign(
114114
{
115115
filename: '[name].css',
116-
orderWarning: true,
117116
},
118117
options
119118
);
@@ -482,20 +481,16 @@ class MiniCssExtractPlugin {
482481
// use list with fewest failed deps
483482
// and emit a warning
484483
const fallbackModule = bestMatch.pop();
485-
if (this.options.orderWarning) {
486-
compilation.warnings.push(
487-
new Error(
488-
`chunk ${chunk.name || chunk.id} [${pluginName}]\n` +
489-
'Conflicting order between:\n' +
490-
` * ${fallbackModule.readableIdentifier(
491-
requestShortener
492-
)}\n` +
493-
`${bestMatchDeps
494-
.map((m) => ` * ${m.readableIdentifier(requestShortener)}`)
495-
.join('\n')}`
496-
)
497-
);
498-
}
484+
compilation.warnings.push(
485+
new Error(
486+
`chunk ${chunk.name || chunk.id} [${pluginName}]\n` +
487+
'Conflicting order between:\n' +
488+
` * ${fallbackModule.readableIdentifier(requestShortener)}\n` +
489+
`${bestMatchDeps
490+
.map((m) => ` * ${m.readableIdentifier(requestShortener)}`)
491+
.join('\n')}`
492+
)
493+
);
499494
usedModules.add(fallbackModule);
500495
}
501496
}

0 commit comments

Comments
 (0)