Skip to content

feat(@angular-devkit/build-angular): use terser instead of uglify-es #11675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 124 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@
"stylus-loader": "^3.0.2",
"symbol-observable": "^1.2.0",
"temp": "^0.8.3",
"terser": "^3.8.1",
"tree-kill": "^1.2.0",
"ts-node": "^5.0.0",
"tslint": "^5.9.1",
"tslint-sonarts": "^1.7.0",
"tsutils": "~2.22.2",
"typescript": "~2.7.2",
"uglifyjs-webpack-plugin": "^1.2.5",
"uglifyjs-webpack-plugin": "github:webpack-contrib/uglifyjs-webpack-plugin#583264da9a34452d30c49e36bb5b39497d0e8f16",
"url-loader": "^1.0.1",
"webpack": "^4.15.1",
"webpack-dev-middleware": "^3.1.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
"style-loader": "^0.21.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"terser": "^3.8.1",
"tree-kill": "^1.2.0",
"uglifyjs-webpack-plugin": "^1.2.5",
"uglifyjs-webpack-plugin": "github:webpack-contrib/uglifyjs-webpack-plugin#583264da9a34452d30c49e36bb5b39497d0e8f16",
"url-loader": "^1.0.1",
"webpack": "^4.15.1",
"webpack-dev-middleware": "^3.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,27 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
}),
new UglifyJSPlugin({
sourceMap: buildOptions.sourceMap,
parallel: true,
cache: true,
uglifyOptions,
// Parallelization turned off because it would required process communication to pass
// on the computed uglifyOptions.
parallel: false,
cacheKeys: (defaultCacheKeys: Object) => {
return Object.assign(
{},
defaultCacheKeys,
{ terser: require('terser/package.json').version },
);
},
minify: (file: string, sourceMap: string) => {
const terserOptions: any = uglifyOptions;

if (sourceMap) {
terserOptions.sourceMap = {
content: sourceMap,
};
}

return require('terser').minify(file, terserOptions);
}
}),
],
},
Expand Down