fix(webpack): notify CLI even if there are compilation errors #10141
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.
PR Checklist
What is the current behavior?
When there's a compilation error, webpack may emit files (depending on how it's configured), however the CLI is never notified of these files, so they are not synced to the device. This is generally the right behavior however there are cases where this isn't ideal, most notably with HMR. When there's a compilation error, a new hash is assigned to the compilation, and files are written but never synced. After fixing the error, yet another hash is generated, however the app will not be able to apply hmr because it must first apply the "errored" hash, and then the fixed one - it works like a sequential chain, and if we don't emit the errored chain links, we break HMR.
What is the new behavior?
The CLI is notified regardless of errors in the compilation. This may crash the app - however that's expected in some cases. In other cases this should fix HMR breakage after a single error during development.
References: