Skip to content

Commit

Permalink
docs: updating docs about filtering warnings warningsFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy committed Apr 8, 2019
1 parent 15dd658 commit 7f4159e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -228,9 +228,7 @@ module.exports = {
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css",
// disables order warnings being logged in terminal after build
orderWarning: true, // Disable to remove warnings about conflicting order between imports
chunkFilename: "[id].css"
})
],
module: {
Expand Down Expand Up @@ -364,6 +362,10 @@ module.exports = {

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

### Remove Order Warnings

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

### Media Query Plugin

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:
Expand Down
25 changes: 10 additions & 15 deletions src/index.js
Expand Up @@ -113,7 +113,6 @@ class MiniCssExtractPlugin {
this.options = Object.assign(
{
filename: '[name].css',
orderWarning: true,
},
options
);
Expand Down Expand Up @@ -482,20 +481,16 @@ class MiniCssExtractPlugin {
// use list with fewest failed deps
// and emit a warning
const fallbackModule = bestMatch.pop();
if (this.options.orderWarning) {
compilation.warnings.push(
new Error(
`chunk ${chunk.name || chunk.id} [${pluginName}]\n` +
'Conflicting order between:\n' +
` * ${fallbackModule.readableIdentifier(
requestShortener
)}\n` +
`${bestMatchDeps
.map((m) => ` * ${m.readableIdentifier(requestShortener)}`)
.join('\n')}`
)
);
}
compilation.warnings.push(
new Error(
`chunk ${chunk.name || chunk.id} [${pluginName}]\n` +
'Conflicting order between:\n' +
` * ${fallbackModule.readableIdentifier(requestShortener)}\n` +
`${bestMatchDeps
.map((m) => ` * ${m.readableIdentifier(requestShortener)}`)
.join('\n')}`
)
);
usedModules.add(fallbackModule);
}
}
Expand Down

0 comments on commit 7f4159e

Please sign in to comment.