Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Proposal to enhance loader error reporting API: structured error reporting #2878
Currently loader context provides an opaque API for error reporting: only
Thus the appearance of error varies widely between different loaders. Babel,
In addition to that there's a lot of duplicated info, some loaders render
I believe this overwhelms users of Webpack and takes a lot more cognitive efforts
The solution I propose is to enhance error reporting API of loaders, namely:
To accept an
With presence of such structured error messages Webpack could render errors in a
Also webpack could provide plugin hooks for different error reporting UIs.
Example of loader API usage:
Such work could be done by loaders themselves (normalizing
I made the following PRs to loaders:
But I believe if we enhance error reporting API it would be a much cleaner
Also see what create-react-app is doing: we can get rid of this with this proposal & a couple of PRs to loadrs too.
I've make a PR #2878 to add loader name to error message internally so that people can see what the error comes from clearly.
About the properties mentioned above, on the one hand there maybe duplicated (