[英]How to build Angular 4.3.6 for production?
I have some questions about an Angular 4 app in production created with angular-cli which uses Webpack. 我对使用Webpack使用angular-cli创建的生产中的Angular 4应用有一些疑问。
Is ng build --prod --aot
the best command for create the final bundle to deploy into a production environment? ng build --prod --aot
是创建最终捆绑软件以部署到生产环境中的最佳命令吗?
If yes, is Tree shaking and AOT and Uglfy configured by default through angular-cli or am I supposed to configure these manually? 如果是,默认情况下是通过angular-cli配置“树木摇晃”以及“ AOT和Uglfy”还是应该手动配置这些?
Is there any other best practice or advice in bundling an Angular 4 app developed with angular-cli? 捆绑使用angular-cli开发的Angular 4应用程序时,还有其他最佳实践或建议吗?
I use @angular/cli version 1.3.1. 我使用@ angular / cli版本1.3.1。
You're very close. 你很亲密 According to the angular-cli documentation on this these are the settings used for the --prod flag:
根据有关此的angular-cli文档 ,这些是--prod标志使用的设置:
--aot true
--environment prod
--output-hashing all
--sourcemaps false
--extract-css true
--named-chunks false
It also does this: 它还这样做:
So using ng build --prod
is all you need to do and angular-cli will handle the rest. 因此,只需执行
ng build --prod
-cli将处理其余工作。
Is ng build --prod --aot the best command for create the final bundle to deploy in prodcution stage...?
ng build --prod --aot是创建要在生产阶段部署的最终捆绑包的最佳命令吗?
I can be short about this, Yes 我可以简短地说,是的
If yes, is Tree shaking and AOT and Uglfy configured by default throught Angular-cli or i am supposed to configure it manually ?
如果是,默认情况下是通过Angular-cli配置树震动以及AOT和Uglfy还是我应该手动配置它?
You don't need to configure it manually. 您无需手动配置。 It's already there.
它已经在那里。
Is there's any other best method or advice to bundle an Angular 4 app developed via Angular-cli ...?
捆绑通过Angular-cli开发的Angular 4应用程序是否还有其他最佳方法或建议?
You can use the experimental option build-optimizer=true
to further decrease you application size. 您可以使用实验性选项
build-optimizer=true
进一步减小应用程序大小。 Note, it is experimental. 注意,这是实验性的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.