Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular-cli specifying file names for production environment

Tags:

angular

Angular is generating random names for the files when running ng build --prod. Is there a way to specify the names we want? We are using angular-cli. We really need this as our angular application is embedded inside a CMS platform.

like image 253
DAG Avatar asked Jul 18 '17 15:07

DAG


People also ask

How angular manage multiple environments CLI?

Adding multiple environments:Open your angular project in a preferred IDE. Navigate to src>environments, there you can see two files environment. ts and environment. prod.

What is environment TS file in angular?

A project's src/environments/ folder contains the base configuration file, environment.ts , which provides a default environment. You can add override defaults for additional environments, such as production and staging, in target-specific configuration files.

What is src folder in angular?

src folder: This is the folder which contains the main code files related to your angular application. app folder: The app folder contains the files, you have created for app components.


1 Answers

If you build in dev mode, files will get the standard names like inline.bundle.js, vendor.bundle.js, main.bundle.js, etc. To build in production mode, use the --prod flag:

ng build --prod

You can use the following flags to prevent file name hashing in production mode:

ng build --prod --output-hashing none

Read more about "build" and its command line options on the Angular docs site.

like image 155
Mauricio De La Quintana Avatar answered Sep 28 '22 05:09

Mauricio De La Quintana