Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): downlevel with non-loose ECMA com…
Browse files Browse the repository at this point in the history
…pliance

This ensures that the ES5 bundles operate consistently with the ES2015+ bundles.

Fixes angular#15673
  • Loading branch information
clydin committed Sep 26, 2019
1 parent 6cb9f4d commit 51e4eaa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@angular-devkit/build-webpack": "0.0.0",
"@angular-devkit/core": "0.0.0",
"@babel/core": "7.6.2",
"@babel/plugin-proposal-class-properties": "7.5.5",
"@babel/preset-env": "7.6.2",
"@ngtools/webpack": "0.0.0",
"ajv": "6.10.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ async function processWorker(options: ProcessBundleOptions): Promise<void> {
filename: options.filename,
inputSourceMap: !manualSourceMaps && options.map !== undefined && JSON.parse(options.map),
babelrc: false,
// Note: plugins are executed before presets
plugins: [
// `loose` mode uses assignment instead of definition for class properties
// This is technically not spec compliant but results in smaller (potentially faster) code
// Further details: https://2ality.com/2012/08/property-definition-assignment.html
['@babel/plugin-proposal-class-properties', { loose: true }],
],
// modules aren't needed since the bundles use webpacks custom module loading
// loose generates more ES5-like code but does not strictly adhere to the ES2015 spec (Typescript is loose)
// 'transform-typeof-symbol' generates slower code
presets: [
['@babel/preset-env', { modules: false, loose: true, exclude: ['transform-typeof-symbol'] }],
],
presets: [['@babel/preset-env', { modules: false, exclude: ['transform-typeof-symbol'] }]],
minified: true,
sourceMaps: options.sourceMaps,
});
Expand Down
21 changes: 20 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@
"@babel/traverse" "^7.4.4"
"@babel/types" "^7.4.4"

"@babel/helper-create-class-features-plugin@^7.5.5":
version "7.6.0"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.6.0.tgz#769711acca889be371e9bc2eb68641d55218021f"
integrity sha512-O1QWBko4fzGju6VoVvrZg0RROCVifcLxiApnGP3OWfWzvxRZFCoBD81K5ur5e3bVY2Vf/5rIJm8cqPKn8HUJng==
dependencies:
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-member-expression-to-functions" "^7.5.5"
"@babel/helper-optimise-call-expression" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-replace-supers" "^7.5.5"
"@babel/helper-split-export-declaration" "^7.4.4"

"@babel/helper-define-map@^7.5.5":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369"
Expand Down Expand Up @@ -351,6 +363,14 @@
"@babel/helper-remap-async-to-generator" "^7.1.0"
"@babel/plugin-syntax-async-generators" "^7.2.0"

"@babel/[email protected]":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4"
integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A==
dependencies:
"@babel/helper-create-class-features-plugin" "^7.5.5"
"@babel/helper-plugin-utils" "^7.0.0"

"@babel/plugin-proposal-dynamic-import@^7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506"
Expand Down Expand Up @@ -8886,7 +8906,6 @@ sauce-connect-launcher@^1.2.4:

"sauce-connect-proxy@https://saucelabs.com/downloads/sc-4.5.4-linux.tar.gz":
version "0.0.0"
uid dc5efcd2be24ddb099a85b923d6e754754651fa8
resolved "https://saucelabs.com/downloads/sc-4.5.4-linux.tar.gz#dc5efcd2be24ddb099a85b923d6e754754651fa8"

saucelabs@^1.5.0:
Expand Down

0 comments on commit 51e4eaa

Please sign in to comment.