-
Notifications
You must be signed in to change notification settings - Fork 513
feat: allow to log invalid orders as warnings instead of errors via option #81
Conversation
any objections @sokra? |
we really would like to see this merged. can you please have a look? |
👍 |
664e78c
to
76a171d
Compare
@@ -284,8 +284,9 @@ ExtractTextPlugin.prototype.apply = function(compiler) { | |||
if(extractedChunk.modules.length) { | |||
extractedChunk.modules.sort(function(a, b) { | |||
if(isInvalidOrder(a, b)) { | |||
compilation.errors.push(new OrderUndefinedError(a.getOriginalModule())); | |||
compilation.errors.push(new OrderUndefinedError(b.getOriginalModule())); | |||
var targetLog = options.relaxInvalidOrder ? compilation.warnings : compilation.errors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could go hand in hand with the ignoreOrder
option, instead of adding a new option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to adapt the PR @michael-ciniawsky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joscha Yep please go ahead, not 💯 my assumption is yet fully correct :)
We are close to a major release, currently in |
When migrating from a large legacy codebase to Webpack, we noticed that many of our CSS group definitions have inconsistent ordering. After trying to fix that ordering for a while, we found out that it was actually not that simple. Especially because the order might be deliberately different per entry-point and there was no way of knowing that without asking the author(s) of the respective CSS group.
The build with the
extract-text-plugin
would still generate the correct (in the sense of the definition given by the developers) output, except the CI would fail because webpack would exit with a non-zero state because of the order "errors".Therefore we introduced an option to the plugin that allows us to degrade those errors to warnings, which makes the developers aware of their inconsistent ordering without breaking the CI build immediately.
fixes #80
cc @joscha