简体   繁体   中英

Angular CLI application change environment property in production

Im new with angular 2/4 and have this issue, I want to be able to change properties without restarting the server or re deploying the application.

I want to be able to change properties IN PRODUCTION

I know if I have some properties in environment.prod.ts when I run

ng build --prod --aot

this properties will be in the main.js file in the dist folder.

I want to know what I have to do if I want to change some property without re build the project.

I want to be able to change properties IN PRODUCTION

You cannot change properties for the production version without rebuilding the app via

ng build --prod --aot

There is nothing actively monitoring the source code in the /dist folder. You also wouldn't want errors (such as typos, syntax errors, even accidents) to affect your production code.

It's good practice to to test everything locally via

ng serve

and then build your final production distribution when you are ready.

Side Note from Docs :

When running ng serve, the compiled output is served from memory, not from disk. This means that the application being served is not located on disk in the dist folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM