Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularCli: disable minification

Tags:

angular-cli

Is there a way to disable the minification in AngularCli?

After I launch the command ng build --prod I need to have all files.js, in dist folder, separate and legible.

like image 536
Danieleee Avatar asked Apr 22 '17 08:04

Danieleee


People also ask

What is Minification in Angular?

Minification: In minification process following things are done within the js file to reduce the size of the js file for faster downloading. It removes all the white spaces within the file. It removes all the unwanted variables within the file. It converts all the big variable names to the smaller variable names.

What does it mean for code to be Minified?

Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used to reduce load times and bandwidth usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience.

What is vendor js file in Angular?

vendor. js : third-party code that your application depends on. polyfills. js : polyfills that allow using newer features in older environments (e.g., using Angular on outdated Web browsers)


3 Answers

Just do:

ng build --prod --optimization=false

That seems to do it. For more information see: https://github.com/angular/angular-cli/wiki/build

This is valid for angular 6.*

like image 85
Ross Avatar answered Oct 24 '22 00:10

Ross


Note: If you use ng serve through some package.json run target, according to the manpage of Angular6 correspoding switch for this is:

ng serve --optimization=false

will speedup this bs in development noticeable

like image 18
mschmoock Avatar answered Oct 24 '22 02:10

mschmoock


ng build --build-optimizer=false

Above command Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.

More details at https://angular.io/cli/build

like image 9
Chetan Laddha Avatar answered Oct 24 '22 02:10

Chetan Laddha