Different build results with --prod vs --prod --aot
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
If I’m not mistaken, the Ahead of Time Compilation is currently enabled by default in ng build
when run with --prod
(as the documentation says).
However, apparently running ng build --prod
and ng build --prod --aot
leads to different results for me.
➜ ng build --prod --aot 10% building modules 3/3 modules 0 activeWarning: Can’t resolve all parameters for SpecificContentService in /path/to/specific-content.service.ts: ([object Object], ?). This will become an error in Angular v6.x 11% building modules 16/19 modules 3 active …path/to/src/assets/scss/main.scssWarning: Can’t resolve all parameters for SpecificContentService in /path/to/specific-content.service.ts: ([object Object], ?). This will become an error in Angular v6.x Warning: Can’t resolve all parameters for SpecificContentService in /path/to/specific-content.service.ts: ([object Object], ?). This will become an error in Angular v6.x Date: 2018-08-16T13:42:36.042Z Hash: 9af835d2f0354778401c Time: 45325ms chunk {main} main.js, main.js.map (main) 2.36 MB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 251 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 425 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 8.91 MB [initial] [rendered]
➜ ng build --prod
Date: 2018-08-16T13:45:37.414Z Hash: d950717427a9e25c7306 Time: 21065ms chunk {main} main.js, main.js.map (main) 878 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 251 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 425 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 7.29 MB [initial] [rendered]
As you can notice from the output, not only the bundle sizes are different but I even got warnings when using --prod --aot
that I normally don’t get.
Command (mark with an x
)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Angular CLI: 6.1.3 Node: 8.10.0 OS: linux x64 Angular: 6.1.2 … animations, common, compiler, compiler-cli, core, forms … http, language-service, platform-browser … platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.7.3 @angular-devkit/build-angular 0.6.8 @angular-devkit/build-optimizer 0.6.8 @angular-devkit/core 0.7.3 @angular-devkit/schematics 0.7.3 @angular/cli 6.1.3 @ngtools/webpack 6.0.8 @schematics/angular 0.7.3 @schematics/update 0.7.3 rxjs 6.2.2 typescript 2.9.2 webpack 4.8.3
Repro steps
Run an Angular project with ng build --prod
and compare its console output with ng build --prod --aot
.
Desired functionality
The behaviour should be the same.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
--prod
is an alias for--configuration=production
and will use the settings defined within the production configuration for the project. Ifaot
is not enabled within the configuration it will not enabled when build is run with the--prod
option. If theaot
option is in fact enabled within the production configuration, please provide the project’sangular.json
file for further analysis.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.