-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat - Allow overlay to be enabled for warnings (#789) #790
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
Conversation
examples/overlay-warnings/README.md
Outdated
|
|
||
| The script should open the browser and show a heading with "Example: overlay with warnings". | ||
|
|
||
| In `app.js`, make a syntax error. The page should now refresh and show a full screen error overlay that shows the syntax error. |
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.
Could you document how to trigger a warning here? This text only tells me how to trigger an error. Would be handy for testing, since I can't come up with something that triggers a warning out the top of my head right now :).
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.
Yeah, the problem is, how to trigger a warning.
I tried copying
// This results in a warning:
// if(!window) require("./" + window + "parseable.js");to the example from modus-inline, but that doesn't trigger a warning at all (not there either). Maybe something changed between webpack 1 and 2?
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.
Jup, in webpack 1 that triggered a warning but in webpack 2 not anymore :'). Looking at webpack's source code on warnings.push, I found that it should trigger a warning when incorrectly cased modules are used. So perhaps add a file caseSensitive.js and import it with casesensitive.js?
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.
The problem is that those two files resolve fine on macOS. It would fail only on Windows and so on.
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.
Yes, but isn't the purpose of the CaseSensitiveModulesWarning plugin to give a warning for that, exactly because it works on macOS but not on Linux/Windows? (I seriously don't know btw, I only looked at the code very quickly 😄 )
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.
The only obvious way I can see would be to go through eslint and eslint-loader. That would work regardless of the platform.
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.
Ah, yeah. I see now. I think I have to add the plugin to the configuration as it's not enabled by default.
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.
Got it. You have to do
require("./casesensitive.js");
require("./caseSensitive.js");It requires multiple, different imports pointing to the same place in order to work. This is enough for me. 👍
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.
Done.
0eb66ff to
a347cde
Compare
Now you can use
{
overlay: {
errors: true,
warnings: true
}
}
Closes webpack#789.
a347cde to
3d8ccd5
Compare
Implemented @ webpack/webpack-dev-server#790, 'overlay: true' is equivalent to 'errors: true' && 'warnings: true'
This change tweaks the feature behavior (implemented @ webpack#790), so it matches the intended behavior (described @ webpack#789). This PR would supersede survivejs/webpack-book#262.
This change tweaks the feature behavior (implemented @ #790), so it matches the intended behavior (described @ #789). This PR would supersede survivejs/webpack-book#262.
What kind of change does this PR introduce?
Feature.
Did you add or update the
examples/?Yes.
Summary
Now you can use
Closes #789.
Does this PR introduce a breaking change?
No.