Faster / parellel i18n AOT builds
Bug Report or Feature Request (mark with an x)
- [ ] bug report -> please search issues before submitting
- [ X ] feature request
Versions.
@angular/cli: 1.1.3 node: 6.10.1 os: darwin x64 @angular/animations: 4.2.4 @angular/common: 4.2.4 @angular/compiler: 4.2.4 @angular/compiler-cli: 4.2.4 @angular/core: 4.2.4 @angular/flex-layout: 2.0.0-beta.8 @angular/forms: 4.2.4 @angular/http: 4.2.4 @angular/material: 2.0.0-beta.7 @angular/platform-browser: 4.2.4 @angular/platform-browser-dynamic: 4.2.4 @angular/platform-server: 4.2.4 @angular/router: 4.2.4 @angular/cli: 1.1.3
Desired functionality.
I'm working on a fairly large app that uses AOT and i18n localization, and we need to translate into 60+ languages. Currently the only option is to run ng build for each language one at a time. For my app this takes 5 hours to complete running them in series. My short-term mitigation is to run ng build in parallel which will helps, but I think we can do better.
My thought is adding something like ng build -prod --i18n-config i18n-config.json
Then, in the config file you could list all the languages you want and the destination directories for each and ng-cli would run them in parallel. Additionally, it feels like it could do the AOT build once and hold the AST in memory then generate each language without having to re-do the entire AOT build for every language. I haven't fully researched this, and I know it'd add a lot of complexity, but for enterprise scale global apps this is absolutely needed to have reasonable build times.
Hi! I am looking as well forward to a solution for this.
Especially as when you are executing the build for multiple locales, you will have a lot of equal files (e.g. runtime.**.js, styles.**.css, polyfill.**.js will stay the same, only the main.**.js file will change according to the locale).
Best, Sebastian
Is there a safe & tested solution for parallel build or speeding up languages builds now?
my solution for i18n parallel build: https://stackoverflow.com/a/56463676/2582581
I'm trying to use https://www.npmjs.com/package/npm-run-all this package with --parallel flag. It works on my machine but will rise my CPU usage to 100% and in our CI machine it will throw memory allocation failed exception, but I think that it is only ram issue and we are testing if more RAM will fix it. Some say that you need to run ng command with extra flag with larger project like this: "ng-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng" but yet it didn't fix my problem.
Internationalization in Ivy is a lot smarter about builds so we don't need to do a full rebuild for each language by simply using the --localize parameter. You can specify only specific languages if you want, or build all of them and re-use most of the computation. This should drastically improve build performance.
https://angular.io/guide/i18n#build-from-the-command-line
If you are still having performance/memory problems when using the Ivy process, then please open a new issue where we can look into that specific problem more closely.
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.