-
Notifications
You must be signed in to change notification settings - Fork 12k
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
fix(@ngtools/webpack): fix compilation not working properly with webpack-dev-server #4009
Conversation
…ack-dev-server Fix files not compiling first time when using @ngtools/webpack with webpack-dev-server, either the server would need to be restarted or another rebuild triggered before updates would show. Fixes #3084
Also fixes #2576 |
@filipesilva please check this. We need to be aware of performance impacting PRs such as this one. We already rebuild the program and re-rebuild it a second time might be a problem. |
@hansl benchmark over master:
Benchmark with these changes:
So:
I think the change on non-aot is just variance since the code change doesn't even run outside of aot. As far as the the PR is concerned, I don't think speed should be a major concern for |
@rynclark is this still a problem? |
I can confirm that this issue still occurs in 1.2.11. Applying this patch fixes the issue. |
Update of angular#4009 by @rynclark to latest version of codebase. TypeScript caches the contents of source files within the program to minimize redundant compilation of non-changing code. This cache is not invalidated in @ngtools/webpack, causing two issues: 1. When the watcher is triggered, the old version of the source is used. A second save is necessary for changes to take effect. 2. When a change would result in a compilation error, the initial save will pass without errors. Subsequent saves, even saves containing fixes to the original error, will continue to fail with the original error. This is likely caused by TypeScript trying to compare any new programs against an invalid prior program state. Signed-off-by: RandomBK <[email protected]>
In hopes of getting this merged asap, I updated this patch to the new codebase and added some observations from my own investigation into this issue at #5164. |
Heya @rynclark @randombk, the original issue you were trying to solved seemed to be broken webpack configuration (#3084 (comment)). I'm looking at this PR in relation to #5137 though, which seems to be exactly what you describe. The changes in this PR break CI however, showing the following error:
This makes me think there's something missing in your solution. |
Not sure why it's breaking CI, it was working when created - haven't had the chance to update it to reflect any recent changes however. This is why I created |
@filipesilva The comment you linked does not help with this issue - I already had The issue continues to occur in My original PR (e2d8276) continues to work with the latest version, but after using it for a while, I noticed that only changes in TypeScript code are handled, while the issue persists with templates. This suggests that the real issue(s) is somewhere deeper in the codebase. |
This should no longer be needed with the new Angular 5 compiler pipeline. |
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. |
When using
@ngtools/webpack
withwebpack-dev-server
, the AoT compiler would use a program created from the last build, causing files not to compile unless the process was restarted or another build was triggered.Creating a new program just before compilation from the old program to grab the latest source code fixes this.
Fixes #3084