From 230e81524693e3417d8e6f6be39d02e8d726ba88 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:04:58 +0100 Subject: [PATCH] Enable @babel/preset-env's ShippedProposals mode (#1580) Enabling this means that preset-env now injects additional plugins for any features that aren't yet stage 3, but have been shipped in at least one browser (meaning they are as good as finalised): https://babeljs.io/docs/en/babel-preset-env#shippedproposals Using this new mode also means we no longer need to manually include the `@babel/plugin-proposal-class-properties` plugin, since it's included in the shipped proposals list as of Babel 7.10.0: https://github.com/babel/babel/pull/11451 --- packages/library/index.js | 1 + packages/node/index.js | 1 + packages/preact/index.js | 6 ------ packages/preact/package.json | 1 - packages/react/index.js | 6 ------ packages/react/package.json | 1 - packages/web/index.js | 1 + 7 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/library/index.js b/packages/library/index.js index 9fa570327..866f7411e 100644 --- a/packages/library/index.js +++ b/packages/library/index.js @@ -47,6 +47,7 @@ module.exports = (opts = {}) => { { debug: neutrino.options.debug, useBuiltIns: coreJsVersion ? 'usage' : false, + shippedProposals: true, targets: options.targets, ...(coreJsVersion && { corejs: coreJsVersion.major }), }, diff --git a/packages/node/index.js b/packages/node/index.js index 4d3926ddd..4652f24c4 100644 --- a/packages/node/index.js +++ b/packages/node/index.js @@ -51,6 +51,7 @@ module.exports = (opts = {}) => { { debug: neutrino.options.debug, targets: options.targets, + shippedProposals: true, useBuiltIns: coreJsVersion ? 'usage' : false, ...(coreJsVersion && { corejs: coreJsVersion.major }), }, diff --git a/packages/preact/index.js b/packages/preact/index.js index 33a65e719..4db267231 100644 --- a/packages/preact/index.js +++ b/packages/preact/index.js @@ -13,12 +13,6 @@ module.exports = (opts = {}) => (neutrino) => { require.resolve('@babel/plugin-transform-react-jsx'), { pragma: 'h', pragmaFrag: 'Fragment' }, ], - // Using loose for the reasons here: - // https://github.com/facebook/create-react-app/issues/4263 - [ - require.resolve('@babel/plugin-proposal-class-properties'), - { loose: true }, - ], ], }, opts.babel || {}, diff --git a/packages/preact/package.json b/packages/preact/package.json index a7a65633b..b34d93108 100644 --- a/packages/preact/package.json +++ b/packages/preact/package.json @@ -29,7 +29,6 @@ }, "dependencies": { "@babel/core": "^7.10.2", - "@babel/plugin-proposal-class-properties": "^7.10.1", "@babel/plugin-transform-react-jsx": "^7.10.1", "@neutrinojs/web": "9.2.0", "babel-merge": "^3.0.0", diff --git a/packages/react/index.js b/packages/react/index.js index 8e5068e4d..8084eb15d 100644 --- a/packages/react/index.js +++ b/packages/react/index.js @@ -30,12 +30,6 @@ module.exports = (opts = {}) => (neutrino) => { removeImport: true, }, ], - // Using loose for the reasons here: - // https://github.com/facebook/create-react-app/issues/4263 - [ - require.resolve('@babel/plugin-proposal-class-properties'), - { loose: true }, - ], ].filter(Boolean), presets: [ [ diff --git a/packages/react/package.json b/packages/react/package.json index 3f44e53af..01d1e6497 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -29,7 +29,6 @@ }, "dependencies": { "@babel/core": "^7.10.2", - "@babel/plugin-proposal-class-properties": "^7.10.1", "@babel/preset-react": "^7.10.1", "@neutrinojs/web": "9.2.0", "babel-merge": "^3.0.0", diff --git a/packages/web/index.js b/packages/web/index.js index 24f05467c..f3257dac5 100644 --- a/packages/web/index.js +++ b/packages/web/index.js @@ -139,6 +139,7 @@ module.exports = (opts = {}) => (neutrino) => { { debug: neutrino.options.debug, useBuiltIns: coreJsVersion ? 'usage' : false, + shippedProposals: true, targets: options.targets, ...(coreJsVersion && { corejs: coreJsVersion.major }), },