For an application we need to keep the classname not minified because we use
var className = myObject.constructor.name;
export class myObject{ ... }
when we run
ng build -- pro
the class name gets minified in a random name.
The MAngle class provides a fundamental type for the Maya API to hold and manipulate angular data. All API methods that require or return angular information do so through variables of this type.
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.
Hence those beautiful names, which are only made inorder for the code readability can be reduced to one or two letter variables. This process converts beautiful, human understandible variable names into ugly ones. Hence this process is called 'Uglification'. Angular also handles this process.
Angular cli builder supports NG_BUILD_MANGLE
, NG_BUILD_MINIFY
, NG_BUILD_BEAUTIFY
node environment params (checked in version 8).
You can set them when running npm script in following way:
env NG_BUILD_MANGLE=false NG_BUILD_MINIFY=false NG_BUILD_BEAUTIFY=true ng build --prod
This will result in unminified output, yet tree shaking and other optimizations will still be applied (compared to just turning off optimization).
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