Closed Lyrkan closed 5 years ago
Thanks for the PR :)
It seems CRA uses stats.toJson({ all: false, warnings: true, errors: true }) to get all warnings and errors recursivly ? Could you try if you can get them like this and the impact it might have on formatters ?
Hey @christophehurpeau,
I'll look into it but I don't think that can be done easily there, at least not without changing how transformers/formatters work.
Calling stats.toJson()
does return error/warning messages (as strings) but transformers/formatters expect a Webpack error that contains other data:
@christophehurpeau Do you think the switch to stats.json()
is worth the hassle?
It'd require to rewrite all the current transformers/formatters (and not only the default ones because of the API changes) in order for them to only use the error message.
Sorry for my late response. You're right I'm not sure stats.json()
is worth but in your implementation it seems you don't handle when isMultiStats(stats)
is true, could you use findErrorsRecursive in this case too and add a test if possible ? Thanks
Hey,
Multi-stats should already be handled by the following code since it also calls extractErrorsFromStats()
recursively:
I'll see if I can add an extra test for that though.
Yes sorry ! I read to quickly. Thanks for the test ! I'll wait for it before merging then :)
There you go!
Released in 2.0.0-beta.2, thank you !
This PR should fix #84 by also looking for errors/warnings recursively in
compilation.children
when none is found incompilation
.Without it the added test gave the following output: