angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.97k forks source link

Taking more then 1hr while build --prod=true with --aot=true in angular 9.1.0 #17469

Closed ajit007kumar closed 4 years ago

ajit007kumar commented 4 years ago

🐞 bug report

Affected Package

When I build my project with below command it is taking more then 1.5 hr to complete its build process node --max_old_space_size=12000 node_modules/@angular/cli/bin/ng build --prod=true --progress=true --verbose=true

Description

[webpack.Progress] 276437ms building [webpack.Progress] 1655ms finish module graph [webpack.Progress] 394ms dependencies optimization [webpack.Progress] 227ms chunk graph [webpack.Progress] 1238ms module optimization [webpack.Progress] 73ms advanced chunk optimization [webpack.Progress] 2002703ms chunk modules optimization [webpack.Progress] 72ms module order optimization [webpack.Progress] 102ms before module ids [webpack.Progress] 59ms module id optimization [webpack.Progress] 21ms chunk id optimization [webpack.Progress] 54ms after chunk id optimization [webpack.Progress] 4604ms hashing [webpack.Progress] 18ms module assets processing [webpack.Progress] 20496ms chunk assets processing [webpack.Progress] 20ms additional chunk assets processing [webpack.Progress] 67ms additional asset processing [webpack.Progress] 1782654ms chunk asset optimization [webpack.Progress] 1871ms emitting ## 🔬 Minimal Reproduction run below command with some configuration like node --max_old_space_size=12000 node_modules/@angular/cli/bin/ng build --prod=true --progress=true --verbose=true configurations :- ### tsconfig.json ``` { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": false, "declaration": false, "module": "esnext", "moduleResolution": "node", "emitDecoratorMetadata": false, "experimentalDecorators": false, "importHelpers": true, "target": "esnext", "typeRoots": [ "node_modules/@types" ], "lib": [ "esnext", "dom" ] }, "angularCompilerOptions": { "enableIvy": true, "allowEmptyCodegenFiles": true } } ``` ### angular.json ``` "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": [ "src/favicon.ico", "src/assets", "src/resources", "src/images" ], "styles": [ "./src/styles.css", "./src/resources/themes/omega/theme.css", "./src/resources/css/main.css", "./src/resources/css/dashboard.css", "./src/resources/css/transactionDetail.css", "./src/resources/css/material-icons.css", "./src/resources/css/alert-style.css", "./src/resources/css/config-styles.css", "./src/resources/css/scenario-styles.css", "./src/resources/css/access-log.css", "./src/resources/css/netocean.css", "./src/resources/css/nethavoc.css", "./src/resources/css/reports.css", "./src/resources/css/netvision.css", "./src/resources/css/ddr-style.css", "./src/resources/css/mon-ui-styles.css", "./src/resources/css/dashboard-sql-query.css", "./src/resources/css/replayStyle.css", "./src/vendors/prettyprint/style/desert.css", "./src/vendors/prettyprint/style/prettify.css", "./src/vendors/jsplumb/demo.css", "./src/resources/css/accesscontrolstyle.css", "./src/resources/css/executive-dashboard.css", "./src/resources/css/light-house.css", "./node_modules/codemirror/lib/codemirror.css", "./node_modules/prismjs/themes/prism-coy.css", "./node_modules/font-awesome/css/font-awesome.min.css", "./node_modules/primeicons/primeicons.css", "./node_modules/primeng/resources/primeng.min.css", "./node_modules/font-awesome/css/font-awesome.css", "src/vendors/ngjsPlumb/css/jsplumbtoolkit-defaults.css", "src/vendors/ngjsPlumb/css/jsplumbtoolkit-demo.css", "src/vendors/ngjsPlumb/css/syntax-highlighter.css", "src/product-icons.css", "src/resources/css/netchannel.css", "./src/unifiedStyle.css" ], "scripts": [ "./src/scripts/utility.js", "./src/vendors/highcharts-plugins/proj4.js", "./src/vendors/prettyprint/js/prettify.js", "./src/vendors/captcha/captcha.js", "./node_modules/hammerjs/hammer.min.js", "./node_modules/jsplumb/dist/js/jsplumb.min.js", "./node_modules/lz-string/libs/lz-string.min.js", "./node_modules/prismjs/prism.js", "./node_modules/codemirror/lib/codemirror.js", "./src/resources/netvision/js/nv_encode_decode.js", "./src/resources/netvision/js/jquery.min.3.2.1.js", "./src/resources/netvision/js/bootstrap.min.3.3.7.js" ] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": true, "buildOptimizer": false, "budgets": [ { "type": "initial", "maximumWarning": "10mb", "maximumError": "30mb" } ] } } }, } } ``` ## 🌍 Your Environment Angular CLI: 9.1.1 Node: 12.16.1 OS: linux x64 Angular: 9.1.1 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, router Ivy Workspace: Yes Package Version ------------------------------------------------------------ @angular-devkit/architect 0.901.1 @angular-devkit/build-angular 0.901.1 @angular-devkit/build-optimizer 0.901.1 @angular-devkit/build-webpack 0.901.1 @angular-devkit/core 9.1.1 @angular-devkit/schematics 9.1.1 @angular/cdk 9.2.0 @angular/flex-layout 9.0.0-beta.29 @angular/material 9.2.0 @angular/material-moment-adapter 9.2.0 @ngtools/webpack 9.1.1 @schematics/angular 9.1.1 @schematics/update 0.901.1 rxjs 6.5.5 typescript 3.8.3 webpack 4.42.0
petebacondarwin commented 4 years ago

It looks to me like this is something happening in the general build pipeline rather than specifically the Angular compiler part, so transferring over to the CLI project...

alan-agius4 commented 4 years ago

Hi @ajit007kumar,

Would you be able to share a reproduction even privately?

From the above it looks like chunk modules optimization and chunk asset optimization phases are taking the most time (approx: 30mins each). It is expected that these 2 phases take some time especially when providing a lot of files in the scripts and styles options. Since both JS and CSS gets minified during these phases. That being said, it's the first time I see reports of such lengthy builds.

Also, It would be good to know the below:

  • What were the timings in version 8?
  • Can you provide the terminal output after running of the ng build (Ie: the size of files)?
rdkmaster commented 4 years ago

Hi @ajit007kumar

try this command instead of use ng build directly:

node --max_old_space_size=4096 ./node_modules/.bin/ng build ... --source-map --aot --prod
dgp1130 commented 4 years ago

Closing as there hasn't been any response from the issue author. Please re-open if you are still seeing problems here.

angular-automatic-lock-bot[bot] commented 4 years ago

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.