-
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
It takes forever in "92% chunk asset optimization" can it be cached or disabled? #5775
Comments
This is Webpack output, not an awesome one. Assets here do not refer to Angular CLI assets. They refer to Webpack chunk files. This is where a big part of the Webpack processing of files happens. That's why it's a long-ish one. There's a very long discussion about the whole build speed topic here #1980. What you are seeing is certainly crazy though (and very unusual from experience with many projects), regardless of this specific message. |
can you provide the command line used to perform the build? |
@clydin I'm using I'm also compiling without Ahead of Time (AoT) though... but my project is big... |
Without AoT the build time is reduced considerably:
But I get more errors with AoT enabled, that's why I want to use it while building. |
Now I need to expand node's heap memory size to compile with AoT. It now uses 5.5GB of RAM to compile with AoT... :(
|
+1, experiencing same problem with --aot enabled on CLI 1.0.0 and Angular 4.
Without --aot it takes around 20 seconds. |
For now, compiling AoT is unusable, and the Angular team knows it. Apparently they are working hard to make it faster, but it will always be significantly (?) slower than just going through the Typescript compiler. Another thing that makes compilation extremely slow (and use a lot of memory) is having source maps enabled. In most situations we compile and develop without sourcemaps enabled because of how slow the rebuilds get when they are enabled. It is not ideal, but there is a lot of work that has to go into Webpack (especially) to make them fast. Wepack has some cheaper source map options but they don't work properly with Typescript, so no go there either. |
AOT is not currently intended for use during development. It is in essence a production optimization similar in some respects to minification or compression. |
@clydin I've used to detect bootstrap errors only present while executing (not compiling). Before writing tests it's very useful. |
@clydin I have the 92% problem using ng test, which means Karma doesn't detect changes and I have to restart ng test every time. Is that the same problem or just a coincidence? |
The @DrMueller |
I had the same performance issue and I saw that by adding
|
@SchnWalter This reduces significantly from 11 seconds to 6 seconds. Awesome. Any affect to development by turning off sourcemap? |
@cevarief |
our AOT build takes 26 seconds. Is there a way to gain insight into what it is building at this step? |
AOT takes some time but I only use it for production builds so it's OK. |
Disabling sourcemap made things much faster for me,
|
I guess I should have been more specific as this is part of |
That slow 36-second |
"ng serve --sourcemap=false" reduced the rebuild time from 20 seconds to 2 seconds in my case. |
My AOT build takes 362 seconds on Google's Compute engine, 1 CPU, 6.5 Gig Ram. Adding more cpus hasn't really made any difference. On my personal computer, it takes about 210 seconds to build the app, which is strange, because it's a 5-year old i7-3660 (OC'd to 4.2ghz, but still). Honestly, this makes deployment frustrating, especially when you get a Javascript Heap Error and you've been waiting 6 minutes just to discover that. As an aside, I think ng build's with aot should set the node memory for you, or you really ought to add this to your default
|
Running into the same issue here, it stops in 94%. Can we customize the shirt @gangsthub? 😄 |
You should stop complaining, update your Angular CLI, fix your AOT build warnings and use AOT also for debugging, since it now supports debugging:
And try to keep up with the Angular CLI releases, things are getting better day by day. P.S. Thanks to everyone working on this! EDIT: With AOT the initial build is slow, subsequent builds are a lot faster. |
I can confirm moving to terser has done the trick as described by @mlwilkerson , the short simple steps are: npm i terser --save-dev and then
In your package.json My build reduced to less than a minute. (from over several mins) |
Please also note that version 7.0 of the CLI now uses terser by default. No additional steps are necessary. |
Hi, i fixed this issue in my work pc using powershell instead wsl. I don't know if any of you are using the linux subsystem but the cpus are locked, you cannot parallelize, so using powershell for build and serve boosted up my times. |
Can anybody tell why this issue has been closed? Our release build still takes literally years to complete. Always hangs at "92% chunk asset optimization". |
My issue with this was solved when I finished using Ubuntu subsystem as npm default manager, it doesn't parallelize and this task last forever. |
@rbluethl, 92% is about where UglifyJSPlugin was being used. Updating to Angular 7 will help because a different plugin (Terser) is used. Also, you may be going out of RAM. Happened to me with a 4GB server at the beginning. I'm still with Angular 6. This is what I'm using in production these days:
And in development:
|
-- prod is - - aot already. |
@gangsthub I tried It's important to note that we are using |
You are right, @DiegoMGar. |
@gangsthub because we have a fairly complex project that requires NGINX, Apache and forwarding these two to a static directory where the frontend source code is accessible (/dist). The "lite server" of Angular doesn't do the trick. |
This seems to be more of an issue if you enable source maps. The following setup/commands work under Angular 7: SourceMap settings in angular.json
Using the following command:
It will stick at 92% for a while, but does eventually build. |
Well, in my case the the process was terminating because of insufficient memory. |
Can we open this issue back again? |
I got this error when i built in docker in Window, i changed the limit of memory to 4GB in virtualbox configuracion and it works for me. |
I think we are facing this issue since Reflect metadata API is now part of the build process of angular, so we will have more computation input but the application will be more faster.I am trying to use some work around building it with Parcel since 1 GB ram is really not enough building complex angular project these days even with 4 GB of swap... It will be really useful if we have cache output from the build so we can then attach this cache to Docker container and only the changes will be build instead the whole application.Yes some will say it will trigger more problems with cache but it depends on how well is written ;) |
Angular-cli 7.1.2 using terser only, removed uglify. The problem is still the same. I don't understand why this issue is closed. |
MacBook Pro 2017 (max configuration). On my colleague's laptop, it took like 6 times longer. Date: 2019-05-22T14:17:10.865Z |
Angular 8. The same issue |
Running with |
reduce |
@bleuscyther Really only any use for small projects, will seriously impair large projects. Still if you have a small project, then this is the setting for you. |
@filipesilva This seemed to be an issue you understood well. Is the issue back? Should this be re-opened? |
I'm using WSL Ubuntu 18.04, tried everything others commented in this thread and I can't build my Angular 7 project. |
This help me solve the problem on t2.micro ,, max time 2 minutescreate swapsudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=3024 If you need more or less than 3024 then change that to something you want. To enable it by default after reboot, add this line to /etc/fstab:/var/swap.1 swap swap defaults 0 0 After doing all these run below command ng build --prod --build-optimizer=false |
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 or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.0.0-rc.2
node: 6.9.2
os: darwin x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0-rc.2
@angular/compiler-cli: 2.4.10
Desired functionality.
assets optimization it rarely changes when you only do coding, and specially for my project it takes 2-5 minutes each time. So it's killing my productivity. With "--verbose" it doesn't show me any specific files which I could remove temporally to speed up the process of compiling...
Thanks.
The text was updated successfully, but these errors were encountered: