Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop renaming of generated files from prod build in angular cli

I don't want angular cli to rename generated script files by ng build --prod and put its link in my index.html file. I just want to use the same name again and again as it does for the development build for the prod build as well.

I know in the .angular-cli.json file holds all configuration but what option I need to place to stop renaming of files for prod build.

Other option is as the angular cli is using webpack internally, is there any way we can configure webpack to handle file renaming.

like image 226
Aniruddha Das Avatar asked Oct 19 '16 14:10

Aniruddha Das


People also ask

Which option can be used to turn off filename hashing when building an Angular app?

If you simply run ng build Angular will create dist folder with files name having hash with it but by using --output-hashing none you can avoid these hash names.

What is configuration file in Angular?

A file named angular. json at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults for build and development tools provided by the Angular CLI. Path values given in the configuration are relative to the root workspace folder.

What is build optimizer Angular?

Created by the Angular team, Build Optimizer is a tool that further optimizes Angular Webpack builds. It identifies code that can be removed at build time without side effects. For instance, Build Optimizer can remove Angular decorators like @Component from AOT builds.

When an Angular application is build using ng build in the Angular CLI where are the built compiled files stored?

ng build command compiles the Angular app into an output directory named dist/ at the given output path. This command must be executed from within the working directory. The application builder in Angular uses the webpack build tool, with configuration options specified in the workspace configuration file (angular.


1 Answers

Use ng build --prod --output-hashing none

like image 135
Simon Kazakov Avatar answered Oct 14 '22 03:10

Simon Kazakov