fix(index): emit warnings as an instance of {Error} instead of {String}#365
fix(index): emit warnings as an instance of {Error} instead of {String}#365maxleaver wants to merge 1 commit into
warnings as an instance of {Error} instead of {String}#365Conversation
alexander-akait
left a comment
There was a problem hiding this comment.
Thanks for PR! Can you add test?
|
/cc @Kovensky can you test this too, thanks |
warnings as an instance of {Error} instead of {String}
michael-ciniawsky
left a comment
There was a problem hiding this comment.
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.
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.
TypeSemVerIssuesChecklist