Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add orderWarnings flag #366

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -50,7 +50,8 @@ module.exports = {
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "[name].css",
chunkFilename: "[id].css"
chunkFilename: "[id].css",
orderWarning: true // Disable to remove warnings about conflicting order
})
],
module: {
Expand Down
25 changes: 15 additions & 10 deletions src/index.js
Expand Up @@ -113,6 +113,7 @@ class MiniCssExtractPlugin {
this.options = Object.assign(
{
filename: '[name].css',
orderWarning: true,
},
options
);
Expand Down Expand Up @@ -480,16 +481,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.orderWarning) {
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);
}
}
Expand Down