diff --git a/README.md b/README.md index 072cb1ff..0ca96e05 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,19 @@ module.exports = { For long term caching use `filename: "[contenthash].css"`. Optionally add `[name]`. +#### Disabling conflicting order warnings + +Option `disableWarnings: boolean`. Default: `false` + +To disable plugin warnings pass `disableWarnings: true` to the plugin options: +``` +plugins: [ + new MiniCssExtractPlugin({ + disableWarnings: true + }) +], +``` + ### 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: diff --git a/src/index.js b/src/index.js index c905bb82..24d30bcc 100644 --- a/src/index.js +++ b/src/index.js @@ -480,16 +480,20 @@ class MiniCssExtractPlugin { // use list with fewest failed deps // and emit a warning const fallbackModule = bestMatch.pop(); - compilation.warnings.push( - new Error( - `chunk ${chunk.name || chunk.id} [mini-css-extract-plugin]\n` + - 'Conflicting order between:\n' + - ` * ${fallbackModule.readableIdentifier(requestShortener)}\n` + - `${bestMatchDeps - .map((m) => ` * ${m.readableIdentifier(requestShortener)}`) - .join('\n')}` - ) - ); + if (!this.options.disableWarnings) { + compilation.warnings.push( + new Error( + `chunk ${chunk.name || chunk.id} [mini-css-extract-plugin]\n` + + 'Conflicting order between:\n' + + ` * ${fallbackModule.readableIdentifier( + requestShortener + )}\n` + + `${bestMatchDeps + .map((m) => ` * ${m.readableIdentifier(requestShortener)}`) + .join('\n')}` + ) + ); + } usedModules.add(fallbackModule); } }