From fbc78b4f74b11849f9c595e344454b51ddb13e4b Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 20 Oct 2017 16:58:57 +0100 Subject: [PATCH] fix(@angular/cli): disable node global The node only `global` object had been left in because it used to cause a build size regression with Angular. This doesn't seem to be the case anymore so it should be removed because it causes problematic interactions with some libraries. Fix #5804 Supersedes #7931 --- package-lock.json | 215 ++++++++++++------ package.json | 2 +- .../cli/models/webpack-configs/browser.ts | 6 +- .../cli/models/webpack-configs/production.ts | 42 ++-- packages/@angular/cli/package.json | 2 +- tests/e2e/tests/build/script-target.ts | 20 +- 6 files changed, 160 insertions(+), 127 deletions(-) diff --git a/package-lock.json b/package-lock.json index e48ec391649d..09e3d7754c92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,38 +45,38 @@ } }, "@angular/compiler": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.4.3.tgz", - "integrity": "sha1-jwEWPa19s0CEl9mdOHVUtrGFrWY=", + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-4.4.6.tgz", + "integrity": "sha1-LuH68lt1fh0SiXkHS+f65SmzvCA=", "dev": true, "requires": { "tslib": "1.7.1" } }, "@angular/compiler-cli": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.4.3.tgz", - "integrity": "sha1-GDr4HxQRhrjWYLBkKVktQLdUCko=", + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.4.6.tgz", + "integrity": "sha1-uv09HiYOmQh+uajPdTLb1gOrubE=", "dev": true, "requires": { - "@angular/tsc-wrapped": "4.4.3", + "@angular/tsc-wrapped": "4.4.6", "minimist": "1.2.0", "reflect-metadata": "0.1.10" } }, "@angular/core": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/@angular/core/-/core-4.4.3.tgz", - "integrity": "sha1-5x0rB76qy6tIq39R1OIobqXXDhU=", + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-4.4.6.tgz", + "integrity": "sha1-EwMf0Q3P5DiHVBmzjyESCVi8I1Q=", "dev": true, "requires": { "tslib": "1.7.1" } }, "@angular/tsc-wrapped": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.4.3.tgz", - "integrity": "sha1-LT84IQodTbA/yG3PHglYErhc0Rk=", + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.4.6.tgz", + "integrity": "sha1-Fnh8u/UL3H5zgSOxnDJSfyROF40=", "dev": true, "requires": { "tsickle": "0.21.6" @@ -447,6 +447,15 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.8.2" + } + }, "array-map": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", @@ -856,9 +865,9 @@ } }, "buffer-indexof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.0.tgz", + "integrity": "sha1-9U9kfE9OJSKLqmVqLlfkPV8nCYI=" }, "buffer-xor": { "version": "1.0.3", @@ -1926,7 +1935,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", - "dev": true, "requires": { "foreach": "2.0.5", "object-keys": "1.0.11" @@ -1945,7 +1953,7 @@ "globby": "6.1.0", "is-path-cwd": "1.0.0", "is-path-in-cwd": "1.0.0", - "p-map": "1.2.0", + "p-map": "1.1.1", "pify": "3.0.0", "rimraf": "2.6.2" }, @@ -2059,9 +2067,9 @@ "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=" }, "dns-packet": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.2.2.tgz", - "integrity": "sha512-kN+DjfGF7dJGUL7nWRktL9Z18t1rWP3aQlyZdY8XlpvU3Nc6GeFTQApftcjtWKxAZfiggZSGrCEoszNgvnpwDg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.1.1.tgz", + "integrity": "sha1-I2nUUDivBF84mOb6VoYq7T9AKWw=", "requires": { "ip": "1.1.5", "safe-buffer": "5.1.1" @@ -2072,7 +2080,7 @@ "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", "requires": { - "buffer-indexof": "1.1.1" + "buffer-indexof": "1.1.0" } }, "doctrine": { @@ -2285,7 +2293,6 @@ "version": "1.8.2", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.8.2.tgz", "integrity": "sha512-dvhwFL3yjQxNNsOWx6exMlaDrRHCRGMQlnx5lsXDCZ/J7G/frgIIl94zhZSp/galVAYp7VzPi1OrAHta89/yGQ==", - "dev": true, "requires": { "es-to-primitive": "1.1.1", "function-bind": "1.1.1", @@ -2298,7 +2305,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", - "dev": true, "requires": { "is-callable": "1.1.3", "is-date-object": "1.0.1", @@ -2736,7 +2742,7 @@ "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", "requires": { - "websocket-driver": "0.7.0" + "websocket-driver": "0.6.5" } }, "figures": { @@ -2888,8 +2894,7 @@ "foreach": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" }, "forever-agent": { "version": "0.6.1", @@ -3433,11 +3438,6 @@ "statuses": "1.3.1" } }, - "http-parser-js": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.6.tgz", - "integrity": "sha1-GVJz9YcExFLWcQdr4gEyndNB3FU=" - }, "http-proxy": { "version": "1.16.2", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.16.2.tgz", @@ -3536,6 +3536,15 @@ "xmldom": "0.1.27" } }, + "import-local": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-0.1.1.tgz", + "integrity": "sha1-sReVcqrNwRxqkQCftDDbyrX2aKg=", + "requires": { + "pkg-dir": "2.0.0", + "resolve-cwd": "2.0.0" + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -3698,14 +3707,12 @@ "is-callable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", - "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", - "dev": true + "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=" }, "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-directory": { "version": "0.3.1", @@ -3717,6 +3724,14 @@ "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=" }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "requires": { + "is-primitive": "2.0.0" + } + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -3816,6 +3831,11 @@ "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=" }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" + }, "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", @@ -3826,7 +3846,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, "requires": { "has": "1.0.1" } @@ -3862,8 +3881,7 @@ "is-symbol": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", - "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", - "dev": true + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=" }, "is-text-path": { "version": "1.0.1", @@ -4404,9 +4422,9 @@ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, "loglevel": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.5.0.tgz", - "integrity": "sha512-OQ2jhWI5G2qsvO0UFNyCQWgKl/tFiwuPIXxELzACeUO2FqstN/R7mmL09+nhv6xOWVPPojQO1A90sCEoJSgBcQ==" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.4.1.tgz", + "integrity": "sha1-lbOD+Ro8J1b9SrCTZn5DCRYfK80=" }, "longest": { "version": "1.0.1", @@ -4751,7 +4769,7 @@ "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.1.1.tgz", "integrity": "sha1-bn3oalcIcqsXBYrepxYLvsqBTd4=", "requires": { - "dns-packet": "1.2.2", + "dns-packet": "1.1.1", "thunky": "0.1.0" } }, @@ -5168,8 +5186,7 @@ "object-keys": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", - "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", - "dev": true + "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=" }, "object.omit": { "version": "2.0.1", @@ -5330,9 +5347,9 @@ } }, "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.1.1.tgz", + "integrity": "sha1-BfXkrpegaDcbwqXMhr+9vBnErno=" }, "pako": { "version": "0.2.9", @@ -5496,6 +5513,24 @@ "pinkie": "2.0.4" } }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "requires": { + "find-up": "2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "2.0.0" + } + } + } + }, "pluralize": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", @@ -6384,7 +6419,10 @@ "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==" + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "requires": { + "is-equal-shallow": "0.1.3" + } }, "regexpu-core": { "version": "1.0.0", @@ -6532,6 +6570,21 @@ "find-parent-dir": "0.3.0" } }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "requires": { + "resolve-from": "3.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + } + } + }, "resolve-from": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", @@ -6678,9 +6731,9 @@ "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" }, "selfsigned": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.1.tgz", - "integrity": "sha1-v4y3uDJWxFUeMTR8YxF3jbme7FI=", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.9.1.tgz", + "integrity": "sha1-zdpEktcNSGVw+HxlVGAjVY4d+lo=", "requires": { "node-forge": "0.6.33" } @@ -6909,7 +6962,7 @@ "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", "requires": { - "websocket-driver": "0.7.0" + "websocket-driver": "0.6.5" } } } @@ -8270,31 +8323,34 @@ } }, "webpack-dev-server": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.7.1.tgz", - "integrity": "sha1-IVgPWgjNBlxxFEz29hw0W8pZqLg=", + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.9.3.tgz", + "integrity": "sha512-bwq7sj452FRH+oVfgOA8xXKkLYPTNsYB4dQ0Jhz3ydjNJ9MvhpGJtehFW8Z0cEcwNkRRiF4aYbReiSGQ4pbS1w==", "requires": { "ansi-html": "0.0.7", + "array-includes": "3.0.3", "bonjour": "3.5.0", "chokidar": "1.7.0", "compression": "1.7.0", "connect-history-api-fallback": "1.3.0", + "debug": "3.1.0", "del": "3.0.0", "express": "4.15.4", "html-entities": "1.2.1", "http-proxy-middleware": "0.17.4", + "import-local": "0.1.1", "internal-ip": "1.2.0", "ip": "1.1.5", - "loglevel": "1.5.0", - "opn": "4.0.2", + "loglevel": "1.4.1", + "opn": "5.1.0", "portfinder": "1.0.13", - "selfsigned": "1.10.1", + "selfsigned": "1.9.1", "serve-index": "1.9.0", "sockjs": "0.3.18", "sockjs-client": "1.1.4", "spdy": "3.4.7", "strip-ansi": "3.0.1", - "supports-color": "3.2.3", + "supports-color": "4.4.0", "webpack-dev-middleware": "1.12.0", "yargs": "6.6.0" }, @@ -8304,13 +8360,25 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" }, - "opn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz", - "integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=", + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { - "object-assign": "4.1.1", - "pinkie-promise": "2.0.1" + "ms": "2.0.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "requires": { + "has-flag": "2.0.0" } }, "yargs": { @@ -8369,18 +8437,17 @@ } }, "websocket-driver": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", - "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.6.5.tgz", + "integrity": "sha1-XLJVbOuF9Dc8bYI4qmkchFThOjY=", "requires": { - "http-parser-js": "0.4.6", - "websocket-extensions": "0.1.2" + "websocket-extensions": "0.1.1" } }, "websocket-extensions": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.2.tgz", - "integrity": "sha1-Dhh4HeYpoYMIzhSBZQ9n/6JpOl0=" + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.1.tgz", + "integrity": "sha1-domUmcGEtu91Q3fC27DNbLVdKec=" }, "when": { "version": "3.6.4", diff --git a/package.json b/package.json index f59990adade5..d8647423d2a2 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "webpack": "~3.8.1", "webpack-concat-plugin": "1.4.0", "webpack-dev-middleware": "~1.12.0", - "webpack-dev-server": "~2.7.1", + "webpack-dev-server": "~2.9.3", "webpack-merge": "^4.1.0", "webpack-sources": "^1.0.0", "webpack-subresource-integrity": "^1.0.1", diff --git a/packages/@angular/cli/models/webpack-configs/browser.ts b/packages/@angular/cli/models/webpack-configs/browser.ts index 312aaab3c687..fe843adf1f8c 100644 --- a/packages/@angular/cli/models/webpack-configs/browser.ts +++ b/packages/@angular/cli/models/webpack-configs/browser.ts @@ -114,13 +114,11 @@ export function getBrowserConfig(wco: WebpackConfigOptions) { ].concat(extraPlugins), node: { fs: 'empty', - // `global` should be kept true, removing it resulted in a - // massive size increase with Build Optimizer on AIO. - global: true, + global: false, crypto: 'empty', tls: 'empty', net: 'empty', - process: true, + process: false, module: false, clearImmediate: false, setImmediate: false diff --git a/packages/@angular/cli/models/webpack-configs/production.ts b/packages/@angular/cli/models/webpack-configs/production.ts index 30946c21f763..9e3b9d0f7ecf 100644 --- a/packages/@angular/cli/models/webpack-configs/production.ts +++ b/packages/@angular/cli/models/webpack-configs/production.ts @@ -127,34 +127,6 @@ export function getProdConfig(wco: WebpackConfigOptions) { const supportES2015 = tsConfig.options.target !== ts.ScriptTarget.ES3 && tsConfig.options.target !== ts.ScriptTarget.ES5; - if (supportES2015) { - extraPlugins.push(new UglifyJSPlugin({ - sourceMap: buildOptions.sourcemaps, - uglifyOptions: { - ecma: 6, - warnings: buildOptions.verbose, - ie8: false, - mangle: true, - compress: uglifyCompressOptions, - output: { - ascii_only: true, - comments: false - }, - } - })); - } else { - uglifyCompressOptions.screw_ie8 = true; - uglifyCompressOptions.warnings = buildOptions.verbose; - extraPlugins.push(new webpack.optimize.UglifyJsPlugin({ - mangle: { screw_ie8: true }, - compress: uglifyCompressOptions, - output: { ascii_only: true }, - sourceMap: buildOptions.sourcemaps, - comments: false - })); - - } - return { entry: entryPoints, plugins: [ @@ -163,6 +135,20 @@ export function getProdConfig(wco: WebpackConfigOptions) { }), new webpack.HashedModuleIdsPlugin(), new webpack.optimize.ModuleConcatenationPlugin(), + new UglifyJSPlugin({ + sourceMap: buildOptions.sourcemaps, + uglifyOptions: { + ecma: supportES2015 ? 6 : 5, + warnings: buildOptions.verbose, + ie8: false, + mangle: true, + compress: uglifyCompressOptions, + output: { + ascii_only: true, + comments: false + }, + } + }), ...extraPlugins ] }; diff --git a/packages/@angular/cli/package.json b/packages/@angular/cli/package.json index 3ed28ae72b29..8fc05efe04b2 100644 --- a/packages/@angular/cli/package.json +++ b/packages/@angular/cli/package.json @@ -79,7 +79,7 @@ "webpack": "~3.8.1", "webpack-concat-plugin": "1.4.0", "webpack-dev-middleware": "~1.12.0", - "webpack-dev-server": "~2.7.1", + "webpack-dev-server": "~2.9.3", "webpack-merge": "^4.1.0", "webpack-sources": "^1.0.0", "webpack-subresource-integrity": "^1.0.1", diff --git a/tests/e2e/tests/build/script-target.ts b/tests/e2e/tests/build/script-target.ts index e8932bf3ff16..633d770f28a1 100644 --- a/tests/e2e/tests/build/script-target.ts +++ b/tests/e2e/tests/build/script-target.ts @@ -1,28 +1,10 @@ -import { appendToFile, expectFileToMatch } from '../../utils/fs'; +import { expectFileToMatch } from '../../utils/fs'; import { ng } from '../../utils/process'; -import { expectToFail } from '../../utils/utils'; import { updateJsonFile } from '../../utils/project'; -import { getGlobalVariable } from '../../utils/env'; export default function () { - - let knownES6Module = '@angular/core/@angular/core'; - - // TODO: swap this check for ng5. - if (getGlobalVariable('argv').nightly) { - // Angular 5 has a different folder structure. - knownES6Module = '@angular/core/esm2015/core'; - } - return Promise.resolve() - // Force import a known ES6 module and build with prod. - // ES6 modules will cause UglifyJS to fail on a ES5 compilation target (default). - .then(() => appendToFile('src/main.ts', ` - import * as es6module from '${knownES6Module}'; - console.log(es6module); - `)) - .then(() => expectToFail(() => ng('build', '--prod'))) .then(() => updateJsonFile('tsconfig.json', configJson => { const compilerOptions = configJson['compilerOptions']; compilerOptions['target'] = 'es2015';