Fix error messages for child compilations #6286
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working with an app that was ejected from create-react-app some time ago, I ran into an issue where the terminal was giving me the usual "Compiled successfully! You can now view cra in the browser." message, while actually opening the app in the browser was resulting in a "Cannot find /" message.
Further investigation showed that the Webpack
compiler
object's output filesystem object was empty, as if the build was failing. In fact, the build of a child compilation for a worker was failing, butreact-dev-utils
was not seeing this asformatWebpackMessages()
only looks atjsonStats.errors
, but ignoresjsonStats.children[i].errors
.Updating
formatWebpackMessages()
to take child compilation errors into account solved the problem, with the "Compiled successfully!" message being replaced with the error that was causing compilation to fail.Unfortunately, I've spent a couple hours trying to put together a simple reproduction that demonstrates the error outside of my old project, but have not been able to reproduce the error. I figure I should submit this anyway in case anybody else does find the error, as I lost most of the day to it. If nobody else is able to reproduce (and you don't merge it anyway), I'll try and spend a couple more hours on my own reproduction.