I want Uuglify Angualr 4 output file files and mangle specific variables that start with my_. The command line below does what I want. I just want to say that the uglifyJs plugin in the angular-cli web package does the same.
> uglifyjs script.js --source-map "filename='script.js.map',includeSources,content=inline" -o script.js -m
-c toplevel --mangle-props \"regex=/^my_[^_]{1}/\" --name-cache uglify-name-cache.json
I am currently exporting a webpack.config.js file from angular-cli with an extract command. But I just can't find the documentation on how to tell uglifyJsplugin from the auto-generated file the regular expression and cache-name parameters. Both of these factors are critical to our application.
From webpack.config.js produced by eject command:
new UglifyJsPlugin({
"test": /\.js$/i,
"extractComments": false,
"sourceMap": true,
"cache": false,
"parallel": false,
"uglifyOptions": {
"output": {
"ascii_only": true,
"comments": false
},
"ecma": 5,
"warnings": false,
"ie8": false,
"mangle": true,
"compress": {}
}
}),
, angualr eject weppack.config . https://www.codesd.com/item/angular-cli-how-to-ignore-class-names-from-being-minified.html , ugllify
.
Some other helpful info:
"dependencies": {
"@angular/common": "4.4.6",
"@angular/compiler": "4.4.6",
"@angular/core": "4.4.6",
"@angular/http": "4.4.6",
"@angular/platform-browser": "4.4.6",
"@angular/platform-browser-dynamic": "4.4.6",
"@angular/router": "4.4.6", },
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "4.4.6",
"@types/node": "7.0.43",
"clean-webpack-plugin": "0.1.17",
"codelyzer": "3.2.2",
"copy-webpack-plugin": "4.2.0",
"uglify-js": "3.1.8",
"webpack": "3.8.1"
}