-
-
Notifications
You must be signed in to change notification settings - Fork 208
fix(index): emit warnings
as an instance of {Error}
instead of {String}
#365
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
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.
Thanks for PR! Can you add test?
/cc @Kovensky can you test this too, thanks |
warnings
as an instance of {Error}
instead of {String}
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.
Please add a test for this. Feel free to ask any question in the PR thread in case you're stuck with the test setup. test/Errors.test.js
(Syntax Error) is a good starting point
.process(css, options) | ||
.then((result) => { | ||
result.warnings().forEach((msg) => this.emitWarning(msg.toString())) | ||
result.warnings().forEach((msg) => this.emitWarning(new Error(msg.toString()))) |
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.
I need to check the Postcss API docs, but I think warnings
can contain location
info and a code frame if the plugin author used the appropiated PostCSS Plugin API. If that's the case it would be better to reuse the code located in lib/Error.js
and create a new class LoaderWarning
(lib/Warning.js
) based upon that to be consistent in terms of formatting
Closing in favor of 6eb82be Thx |
Warnings are currently sent to webpack as strings. However, Webpack's emitWarning function expects an error, as described in their API. This results in the errors described in #350. This PR simply changes the warnings emitted by postcss-loader from strings to an error instance.
Type
SemVer
Issues
Checklist