I have one silly question. I'm wondering about ways to speed up my app. In most cases the popular one is to use --prod
flag during build. But also I found an advice to enable Angular production mode with
enableProdMode();
in main.ts
. Are these actions the same and trigger the same mechanism?
相关问题
- Angular RxJS mergeMap types
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- Plugin with id 'com.google.gms.google-services
- How to update placeholder text in ng2-smart-table?
- How to instantiate Http service in main.ts manuall
相关文章
- angular脚手架在ie9+下兼容问题
- angular 前端项目 build 报错 "Cannot find module 'le
- Angular Material Stepper causes mat-formfield to v
- After upgrade to Angular 9 cannot find variable in
- is there any difference between import { Observabl
- Suppress “Circular dependency detected” suppress w
- How can you get current positional information abo
- Angular material table not showing data
But remember that if you do something like this:
then flags from production envy are going to be overwritten. I checked it as I was still having problems with performance despite using --prod flag on non prod envy. This is important when building demos, benchmarking builds and so on.
The
--prod
flag triggers the--environment=prod
flag (among other things). This means that the environment file defined asprod
in theenvironments
array of the.angular-cli.json
is used during compilation.If you have the default
main.ts
this will indeed mean it runsenabledProdMode()
. Because they use this to trigger it:and in the environment file the
production
property is set totrue
.