Build times very slow with NX 12
See original GitHub issueCurrent Behavior
Since the upgrade to NX 12.0.6 the build on my dev machine(3700x, 32gb Ram) takes ~30 minutes. It took like 2 minute max. When I run with --progress=true It gets stuck while showing ‘30% building x/n modules 50 active’. I noticed that only one core will be utilized, while the rest stays idle and the memory usage reached the default threshold(2 GB) and then drops to ~700 MB multiple times. Once the cache is build the build times become fast again.
Expected Behavior
Build time should be on par with 11.4.
Steps to Reproduce
I’m unable to do this right now. Our project:
- uses SCSS
- has one .ts file with 5 MB(which contains our auto-generated api services)
When I edit this file and retry to compile It seems It will take ages to build again. So It definitely seems to be a problem with some babel/webpack plugin and larger code files.
Failure Logs
Environment
yarn run v1.22.5$ nx report
> NX Report complete - copy this into the issue template
Node : 14.16.0
OS : linux x64
yarn : 1.22.5
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 12.0.6
@nrwl/cypress : 12.0.6
@nrwl/devkit : 12.0.6
@nrwl/eslint-plugin-nx : 12.0.6
@nrwl/express : Not Found
@nrwl/jest : 12.0.6
@nrwl/linter : 12.0.6
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 12.0.6
@nrwl/react : 12.0.6
@nrwl/schematics : Not Found
@nrwl/tao : 12.0.6
@nrwl/web : 12.0.6
@nrwl/workspace : 12.0.6
@nrwl/storybook : 12.0.6
@nrwl/gatsby : Not Found
typescript : 4.1.5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Why is NX 12 slower than NX 10.... Updated?
Hello, We recently moved from NX 10 to NX 12 and it seems like NX 12 is quite a bit slower than 10....
Read more >NX12 Performance. - Siemens: UG/NX - Eng-Tips
Has anyone noticed that NX12 seems to be slower when performing simple tasks? things like using the undo function seems to take more...
Read more >How to Speed up Your NX - ME 5763
Step 1: Setting “Visualization Performance” ... In this prompt dialog box, click on Evaluate Graphics Performance. This will launch an evaluation process and ......
Read more >How to speed up your Angular builds - Bitovi
So if you are running into slow Angular builds, try these steps to reduce build time. They are listed in order of increasing...
Read more >Angular 12 'ng serve' builds apps slowly, almost like ...
Everything runs fine, except that when I am developing and using 'ng serve', rebuild times are much, much slower now, to the point...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@soer7022 I don’t think we can solve this problem. I think as of now nx needs better ways to debug and profile the build process, because we just need to accept the fact that a lot of the JS build tools are kinda awful IMO. I suggest we add options to create a profile via the webpack ProfilingPlugin and use the SpeedMeasurePlugin to get a better overview about the build times.
@HaveF as kenptr pointed out you set the webpack config path in your workspace.json. Then you can use something like this:
With profiling I found the error actually It seems that ‘babel-plugin-transform-typescript-metadata’ is the problem here and takes 30 minutes to detect that my 5mb client.ts file is too large to process. I disabled ‘emitDecoratorMetadata’, which is enabled by default, for now which works as a workaround.
Is there an option to use NX without Babel? Because I would prefer to keep out as much build tools written in pure JS as possible, because in general I think they are low quality and hard to debug.