Issue
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.
Solution
Angular cli uses webpack and uglify internally. One solution would be changing the options in uglify by exporting the webpack configuration. You can see the webpack files by running ng eject, and ng eject --prod
new UglifyJsPlugin({
"mangle": false,
"compress": {
"screw_ie8": true,
"warnings": false
},
"sourceMap": false
}),
Mangle = false will preserve class names. The lack of options for webpack in angular cli is one big discussion atm.
You can alse set exclusions like this:
mangle: {
except: ['foozah']
}
Note: after ejecting you can remove ejected true from angular-cli.json to do it again or serve/build normally.
"project": {
"name": "test",
"ejected": true //remove
},
Answered By - Andres M
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.