Skip to content

Commit

Permalink
fix(babel-preset-gatsby-package): remove explicit `@babel/plugin-prop…
Browse files Browse the repository at this point in the history
…osal-class-properties` and let `@babel/preset-env` add it (#24640)

* fix error from babel about `loose: true`

* update snapshots for tests

* remove @babel/plugin-proposal-class-properties

* update jest snapshots

* remove class-properties from dependencies

Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
  • Loading branch information
Js-Brecht and gatsbybot committed Jun 9, 2020
1 parent c3ecb22 commit 272ba4f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Expand Up @@ -54,7 +54,6 @@ Array [

exports[`babel-preset-gatsby-package in browser mode specifies the proper plugins 1`] = `
Array [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-runtime",
Expand Down Expand Up @@ -111,7 +110,6 @@ Array [

exports[`babel-preset-gatsby-package in node mode specifies the proper plugins 1`] = `
Array [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-runtime",
Expand Down
5 changes: 2 additions & 3 deletions packages/babel-preset-gatsby-package/index.js
Expand Up @@ -4,7 +4,7 @@ function preset(context, options = {}) {
const { browser = false, debug = false, nodeVersion = `10.13.0` } = options
const { NODE_ENV, BABEL_ENV } = process.env

const IS_TEST = (BABEL_ENV || NODE_ENV) === `test`
const IS_TEST = (BABEL_ENV || NODE_ENV) === `test`

const browserConfig = {
useBuiltIns: false,
Expand Down Expand Up @@ -39,12 +39,11 @@ function preset(context, options = {}) {
r(`@babel/preset-flow`),
],
plugins: [
r(`@babel/plugin-proposal-class-properties`),
r(`@babel/plugin-proposal-nullish-coalescing-operator`),
r(`@babel/plugin-proposal-optional-chaining`),
r(`@babel/plugin-transform-runtime`),
r(`@babel/plugin-syntax-dynamic-import`),
IS_TEST && r(`babel-plugin-dynamic-import-node`)
IS_TEST && r(`babel-plugin-dynamic-import-node`),
].filter(Boolean),
overrides: [
{
Expand Down
1 change: 0 additions & 1 deletion packages/babel-preset-gatsby-package/package.json
Expand Up @@ -9,7 +9,6 @@
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby-package#readme",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1",
"@babel/plugin-proposal-optional-chaining": "^7.10.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
Expand Down

0 comments on commit 272ba4f

Please sign in to comment.