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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With