Skip to content
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

Errors/warnings added by ts-loader do not respect webpack API #1199

Closed
lorenzodallavecchia opened this issue Oct 17, 2020 · 5 comments · Fixed by #1255
Closed

Errors/warnings added by ts-loader do not respect webpack API #1199

lorenzodallavecchia opened this issue Oct 17, 2020 · 5 comments · Fixed by #1255

Comments

@lorenzodallavecchia
Copy link
Contributor

I'm processing webpack errors/warnings in the compilation results.

Expected Behaviour

The errors and warnings reported by ts-loader through webpack should implement the WebpackError interface.
Starting from webpack 5 the interface is part of webpack's official typings.

Actual Behaviour

Instead of including the loc property with start/end positions of the error, the object added by ts-loader includes a location property with just the starting position. This is easily seen in the webpack stats object produced by the compilation.

stats.compilation.errors; // each error misses the 'loc' property
stats.compilation.warnings; // each warning misses the 'loc' property

Probably as a consequence of this, when I transform the stats into JSON, there is no location information for the errors.

const json = stats.toJson({ all: false, errors: true, warnings: true });
json.errors; // 'loc' missing in errors
json.warnings; // 'loc' missing in warnings
@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 25, 2020
@lorenzodallavecchia
Copy link
Contributor Author

The problem is still present, no reason to close this.

@stale stale bot removed the wontfix label Jan 11, 2021
@johnnyreilly
Copy link
Member

Would you like to work on this?

@lorenzodallavecchia
Copy link
Contributor Author

Yes, I would like to. I hope to find some time to do a PR in the coming days.

@johnnyreilly
Copy link
Member

Thanks for contributing! Should be released in the next 20 mins https://github.com/TypeStrong/ts-loader/releases/tag/v8.0.17

This was referenced Mar 11, 2021
This was referenced Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants