-
Notifications
You must be signed in to change notification settings - Fork 12k
Inconsistency behavior when handling errors #15887
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
Comments
Hi @Fatme, Yes, it's intended that type errors aren't sent to Webpack when using the forked type checker. If they were, and they blocked the compilation, then there's no reason to in having a forked type checker turned on as rebuilds would just take much longer. |
Hey @alan-agius4,
As far as I understand you, you mean that it is intentional not stopping on type errors. A time ago we opened a PR that respects noEmitOnError typescript’s compiler option when emitting the code. The PR was closed due to the following reason:
But if the incremental compilation is never stopping on type errors, how the users can correct their errors within the application? So, it's really confusing why the type errors are respected only on first run. Shouldn't the behavior be unified for both cases - first run and incremental compilation? |
Hey @alan-agius4, We discussed the problem with the team and we have the following suggestion: What about introducing
Let us know about your opinion on that matter. |
An option for that already exists: |
Hey @clydin,
This option is different from the proposed
No, the type checking will be done from the forked process, webpack compilation will be blocked on afterCompile hook until we receive a response from the forked process in case when This will be beneficial when |
Ping @alan-agius4 @clydin. |
Personally, I am not entirely sure how beneficial it would to be to have an async forked type checking vs inline type checking in the same process. Even then, considering that most users are more interested in having the shortest possible incremental builds rather than not a compilation marked as not successful during rebuild. I am not sure if this is worth the future maintenance and support that it will need. @clydin what do you think? |
Hey @alan-agius4,
We have the opposite case - our users want to know when the compilation is not successful rather than having a runtime crashed mobile application as it is much harder for debugging and investigating what exactly caused the problem.
I think that the future maintenance will be needed only in case when updating to the next major version of webpack. It shouldn't be affected by other changes and should not affect other parts of the code. It should be used mainly when The feature is really important for our error handling story aiming to improve the current development experience of our users. |
It is true that we could feed errors back from the type checker into the main compilation process, blocking compilation until they get there. But I don't see what the purpose is when it's already possible to wholly disable the type checker via the The main purpose of the forked is to reduce the rebuild time, at the cost of type correctness. To be fair it is always jarring to have type errors come after compilation is supposedly done, and it's not a great user experience when there are errors. It's pretty ok when there are no errors though, then it's just a net improvement. The resource strain can also be considerable on AOT compilations, and the forked type checker always uses a lower fidelity compilation since it doesn't have the full webpack pipeline behind it. The proposed So to me adding I understand that it's possible, but I don't see the cases where it's desirable. Do you have cases where you think |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
No.
Description
Handling only syntax errors when it is not a first run
It seems that
AngularCompilerPlugin
handles both syntactic and semantic errors on first run, but it handles only syntax errors when it is not the first run.angular-cli/packages/ngtools/webpack/src/angular_compiler_plugin.ts
Lines 1272 to 1273 in 95776fe
This lead to the following inconsistency behavior when executing
ng serve
:First run
app.component.ts
:ng serve
Actual behavior:
Not a first run
ng serve
app.component.ts
:Actual behavior:
As it can be seen, the
webpack
compilation is not successful on first run but it is fine when it is not the first run. I'm wondering if this is the intended behavior and what is the reason for that behavior.Currently we're relying on
AngularCompilerPlugin
and in case it is intended behavior, is it possible to introduce an option so the diagnostics mode can be forced? That will give us the ability to handle both syntax and semantic errors regardless if it is first run or not.🔬 Minimal Reproduction
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
The text was updated successfully, but these errors were encountered: