From eb6fb2d8f9b7f477ddde60466d2812e3b8d2d0bc Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 9 Mar 2018 21:01:53 -0800 Subject: [PATCH] build: switch from uglify-js to uglify-es (#22669) This enables us to minify ES2015 code. PR Close #22669 --- build.sh | 5 +++-- package.json | 2 +- yarn.lock | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index e9334f1a59..cc67146363 100755 --- a/build.sh +++ b/build.sh @@ -219,7 +219,8 @@ minify() { base_file=$( basename "${file}" ) if [[ "${base_file}" =~ $regex && "${base_file##*.}" != "map" ]]; then local out_file=$(dirname "${file}")/${BASH_REMATCH[1]}.min.js - $UGLIFYJS -c --screw-ie8 --comments -o ${out_file} --source-map ${out_file}.map --prefix relative --source-map-include-sources ${file} + echo "====== $UGLIFY -c --comments -o ${out_file} --source-map "includeSources=true,content='${file}.map',filename='${out_file}.map'" ${file}" + $UGLIFY -c --comments -o ${out_file} --source-map "includeSources=true,content='${file}.map',filename='${out_file}.map'" ${file} fi done } @@ -344,7 +345,7 @@ N=" " TSC=`pwd`/node_modules/.bin/tsc NGC="node --max-old-space-size=3000 `pwd`/dist/tools/@angular/compiler-cli/src/main" -UGLIFYJS=`pwd`/node_modules/.bin/uglifyjs +UGLIFY=`pwd`/node_modules/.bin/uglifyjs TSCONFIG=./tools/tsconfig.json ROLLUP=`pwd`/node_modules/.bin/rollup diff --git a/package.json b/package.json index 6ffe69e980..883e050cd2 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "tslint-eslint-rules": "4.1.1", "tsutils": "2.20.0", "typescript": "2.7.x", - "uglify-js": "2.8.29", + "uglify-es": "^3.3.9", "universal-analytics": "0.4.15", "vlq": "0.2.2", "vrsource-tslint-rules": "5.1.1", diff --git a/yarn.lock b/yarn.lock index 00e0e00531..62c6c7c202 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1203,6 +1203,10 @@ commander@^2.5.0, commander@^2.8.1, commander@^2.9.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" +commander@~2.13.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + commondir@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2" @@ -6562,6 +6566,10 @@ source-map@^0.4.4, source-map@~0.4.1: dependencies: amdefine ">=0.0.4" +source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + sparkles@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" @@ -7208,6 +7216,13 @@ typescript@2.7.x: version "2.7.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" +uglify-es@^3.3.9: + version "3.3.9" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" + dependencies: + commander "~2.13.0" + source-map "~0.6.1" + uglify-js@1.2.6, uglify-js@~1.2.5: version "1.2.6" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-1.2.6.tgz#d354b2d3c1cf10ebc18fa78c11a28bdd9ce1580d" @@ -7216,7 +7231,7 @@ uglify-js@1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-1.3.3.tgz#ddd3e98aa27f5f47e589cfb3f95cddba26096190" -uglify-js@2.8.29, uglify-js@^2.6: +uglify-js@^2.6: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: