Parallelize ES5 & ES2015 builds
See original GitHub issueπ Feature request
Having a possibility to serve ES2015 is awesome! But, the build time was increased nearly twice because now instead of one build we have two.
Please provide ways to deal with this.
Command (mark with an x)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
The build time has significantly increased because ES5 and ES2015 builds are sequential.
Is there some reasoning behind this? Would it be faster to run them in parallel (at least with some explicit settings)?
Describe the solution youβd like
- Parallelize those builds by default (or with special CLI flag probably)
- Add a special CLI flag / configuration in angular.json that allows to build es5 and es2015 separately on different runners. This would be cool for CI because the builds could run on different physical devices (at least for CI tools where the dist folder gets mounted, e.g. Drone CI). This could cause problems with sharing the same
distdirectory (that is cleared before build), so this needs to be somehow resolved. However, if the option 1 is in place, I guess, this could be omitted
Describe alternatives youβve considered
Disabling es2015 build π¦
Issue Analytics
- State:
- Created 4 years ago
- Reactions:30
- Comments:20 (9 by maintainers)
Top Results From Across the Web
Speeding up Angular 10 parallel production build - Ljiljana Matic
At QACube, we have Angular 10 workspace with 6 projects that are built in parallel for production. Over time, our CI/CD pipeline has...
Read more >Why does Angular build create files with 'es5' and 'es2015' but ...
Angular doesn't bundle the JavaScript files into a single file. You can add a build step to concat the files together. concat-build.js:
Read more >JavaScript (ES2015+) Enlightenment - Frontend Masters
These compilers are routinely used as part of a build/bundling module process where ... To make all the calls run in parallel, Promise.all()...
Read more >TypeScript vs ES6 vs ES2015 - Excella
Typescript vs ES6 vs ECMA2015 - decide which is best for your application with our rundown on typings, classes, async and promises for...
Read more >30. An overview of what's new in ES6 - Exploring JS
The ECMAScript library of built-ins has been expanded to support additional ... 0xFF // ES5: hexadecimal 255 > 0b11 // ES6: binary 3...
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

Angular CLI 8.3 and above no longer perform two full builds to support differential loading. Only an ES module compatible build is now created and then down-leveled directly to ES5. This can greatly reduce the time taken to perform a build especially for larger applications.
There are some concerns about progress reporting but they are minor.
As far as the individual build steps go, they are mostly parallelizable. Almost all compilation steps inside webpack run in the single thread.
There are three very expensive steps that only happen in prod builds: build-optimizer, module concatenation, and minification. Of these, only minification uses parallel processing.
But parallelizing things that themselves try to parallelize does not compose well. At some point the minification steps of both builds would look at the total available CPUs and say βright, so letβs use them allβ. The best case scenario there is that both just bottleneck and get slower.
Thatβd be the end of it if CPU was the only relevant shared resource. But there is another one: memory. And that one is less easy to manage. Memory management is Node is mostly static, you define a maximum and there it goes. In Node 12 it figures out the maximum at the start, but thatβs still static from there on.
The really bad case is that at some point there are 2 minification processes that are processing a really big chunk (like
main) and one/both will hit the memory and crash. To prevent that weβd have to ensure no two builds try to minify at the same time, or that minification doesnβt use parallelism.But Iβm not sure thatβd be such a great win insofar as build time. I canβt imagine it would reduce it to half. Parallelization rarely does.
As an aside, we should figure out why the build time in webpack isnβt the full time. It really should be in your first screenshot.