diff --git a/src/index.js b/src/index.js index 468aadb8..a6e2aaf7 100644 --- a/src/index.js +++ b/src/index.js @@ -113,6 +113,7 @@ class ExtractCssChunksPlugin { this.options = Object.assign( { filename: '[name].css', + orderWarning: true, }, options ); @@ -495,18 +496,22 @@ class ExtractCssChunksPlugin { // use list with fewest failed deps // and emit a warning const fallbackModule = bestMatch.pop(); - compilation.warnings.push( - new Error( - `chunk ${chunk.name || - chunk.id} [extract-css-chunks-webpack-plugin]\n` + - 'Conflicting order between:\n' + - ` * ${fallbackModule.readableIdentifier(requestShortener)}\n` + - `${bestMatchDeps - .map((m) => ` * ${m.readableIdentifier(requestShortener)}`) - .join('\n')}` - ) - ); - usedModules.add(fallbackModule); + if (this.options.orderWarning) { + compilation.warnings.push( + new Error( + `chunk ${chunk.name || + chunk.id} [extract-css-chunks-webpack-plugin]\n` + + 'Conflicting order between:\n' + + ` * ${fallbackModule.readableIdentifier( + requestShortener + )}\n` + + `${bestMatchDeps + .map((m) => ` * ${m.readableIdentifier(requestShortener)}`) + .join('\n')}` + ) + ); + usedModules.add(fallbackModule); + } } } } else {