Skip to content

Commit d9ebdc5

Browse files
docs: updating docs about filtering warnings warningsFilter
1 parent 55b6158 commit d9ebdc5

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
@@ -186,9 +186,7 @@ module.exports = {
186186
plugins: [
187187
new MiniCssExtractPlugin({
188188
filename: "[name].css",
189-
chunkFilename: "[id].css",
190-
// disables order warnings being logged in terminal after build
191-
orderWarning: true, // Disable to remove warnings about conflicting order between imports
189+
chunkFilename: "[id].css"
192190
})
193191
],
194192
module: {
@@ -322,6 +320,10 @@ module.exports = {
322320

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

323+
### Remove Order Warnings
324+
325+
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
326+
325327
### Media Query Plugin
326328

327329
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
);
@@ -481,20 +480,16 @@ class MiniCssExtractPlugin {
481480
// use list with fewest failed deps
482481
// and emit a warning
483482
const fallbackModule = bestMatch.pop();
484-
if (this.options.orderWarning) {
485-
compilation.warnings.push(
486-
new Error(
487-
`chunk ${chunk.name || chunk.id} [${pluginName}]\n` +
488-
'Conflicting order between:\n' +
489-
` * ${fallbackModule.readableIdentifier(
490-
requestShortener
491-
)}\n` +
492-
`${bestMatchDeps
493-
.map((m) => ` * ${m.readableIdentifier(requestShortener)}`)
494-
.join('\n')}`
495-
)
496-
);
497-
}
483+
compilation.warnings.push(
484+
new Error(
485+
`chunk ${chunk.name || chunk.id} [${pluginName}]\n` +
486+
'Conflicting order between:\n' +
487+
` * ${fallbackModule.readableIdentifier(requestShortener)}\n` +
488+
`${bestMatchDeps
489+
.map((m) => ` * ${m.readableIdentifier(requestShortener)}`)
490+
.join('\n')}`
491+
)
492+
);
498493
usedModules.add(fallbackModule);
499494
}
500495
}

0 commit comments

Comments
 (0)