x)- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
No.
There are 3500 components/modules in this app. Everything lazy-loaded. When I run ng serve and edit any one file. The rebuild should be shorter because the lazy chunks have not changed.
git clone https://github.com/doggy8088/ng-cli-800-3500-components.git
cd ng-cli-800-3500-components
npm install
ng serve
Edit the src/app/features/page0001/page0001.component.ts file, it will wait more than 40 seconds to complete. It should be shorter.
No error. It just slower than expected.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.0.6
Node: 10.16.0
OS: win32 x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.800.6
@angular-devkit/build-angular 0.800.6
@angular-devkit/build-ng-packagr 0.800.6
@angular-devkit/build-optimizer 0.800.6
@angular-devkit/build-webpack 0.800.6
@angular-devkit/core 8.0.6
@angular-devkit/schematics 8.0.6
@angular/cli 8.0.6
@ngtools/json-schema 1.1.0
@ngtools/webpack 8.0.6
@schematics/angular 8.0.6
@schematics/update 0.800.6
ng-packagr 5.3.0
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Anything else relevant?
N/A
Tried the repro, and could see ~40s rebuild time on my machine. Noticed that TS processing took very long, some processing that I wasn't expecting to happen with chunks did, and that there was some sort of hashing computation done for the lazy modules too.
Something else that I found interesting: rebuilding at still takes ~14s after removing AppRoutingModuleimport. Rebuilds get back to ~1s after I delete src/app/features and src/app/app-routing.module.ts. This points to TS compilation still building those TS files, likely because they are always included in tsconfig.app.json (which we want to change in https://github.com/angular/angular-cli/pull/15030 and https://github.com/angular/angular-cli/pull/15061).
@sanderelias also mentioned that he saw high CPU usage on this repo in between builds. He thought it was due to the file watchers.
Having the same issue with similar dependencies.
Been looking into this and there are two parts to the problem:
main.ts) all files are emitted by TSTogether these two things make the rebuild for a console.log(1); in main.ts be ~25s instead of ~1s.
The first problem was actually reported in https://github.com/angular/angular-cli/issues/14775 and already addressed in https://github.com/angular/angular-cli/pull/14778. I tested your repro with @angular-devkit/[email protected] and saw build times go down to 13s.
The second part I'm still trying to identify.
Opened an issue in Webpack: https://github.com/webpack/webpack/issues/9460. I could reproduce that having many chunks slows down webpack compilations (without any CLI stuff) even when the lazy chunks don't change.
Updating to webpack 4.38 (https://github.com/angular/angular-cli/pull/15170) should fix it, as the Webpack folks just added some very impressive (2x to 5x) rebuild perf improvements for this case.
Any real world metrics about the effect of the fix?
@sokra I compared dev rebuilds using @angular-devkit/[email protected] (which uses [email protected]) versus @angular-devkit/[email protected] (which uses [email protected], the version with your fixes) in a few projects:
So no apparent improvement with 0 lazy chunks, and increasingly bigger improvement as more lazy chunks are present.
Closing as the fix has been merged and released.
@filipesilva I didn't see this issue on release notes. Which version been applied?
@doggy8088 the PR that updated our version of webpack was https://github.com/angular/angular-cli/pull/15170, released first in https://github.com/angular/angular-cli/releases/tag/v8.2.0-rc.0. You should get it by updating to @angular-devkit/[email protected] or higher.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Tried the repro, and could see ~40s rebuild time on my machine. Noticed that TS processing took very long, some processing that I wasn't expecting to happen with chunks did, and that there was some sort of hashing computation done for the lazy modules too.
Something else that I found interesting: rebuilding at still takes ~14s after removing
AppRoutingModuleimport. Rebuilds get back to ~1s after I deletesrc/app/featuresandsrc/app/app-routing.module.ts. This points to TS compilation still building those TS files, likely because they are always included intsconfig.app.json(which we want to change in https://github.com/angular/angular-cli/pull/15030 and https://github.com/angular/angular-cli/pull/15061).@sanderelias also mentioned that he saw high CPU usage on this repo in between builds. He thought it was due to the file watchers.