Skip to content

Commit

Permalink
fix(babel): remove preset-env included plugin class-properties (#9232)
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed May 3, 2021
1 parent 65e62b9 commit 0b35ce5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/babel-preset-app/package.json
Expand Up @@ -18,6 +18,7 @@
"@babel/plugin-proposal-decorators": "^7.13.15",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@babel/plugin-proposal-private-methods": "^7.13.0",
"@babel/plugin-transform-runtime": "^7.13.15",
"@babel/preset-env": "^7.14.0",
"@babel/runtime": "^7.14.0",
Expand Down
14 changes: 12 additions & 2 deletions packages/babel-preset-app/src/index.js
Expand Up @@ -135,7 +135,15 @@ module.exports = (api, options = {}) => {
ignoreBrowserslistConfig,
configPath,
include,
exclude: polyfills.concat(exclude || []),
exclude: [
...exclude || [],
...polyfills,
// Although preset-env includes class-properties
// but webpack 4 doesn't support the syntax when target supports and babel transpilation is skipped
// https://github.com/webpack/webpack/issues/9708
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods'
],
shippedProposals,
forceAllTransforms
}
Expand All @@ -151,7 +159,9 @@ module.exports = (api, options = {}) => {
decoratorsBeforeExport,
legacy: decoratorsLegacy !== false
}],
[require('@babel/plugin-proposal-class-properties'), { loose: true }]
// class-properties and private-methods need same loose value
[require('@babel/plugin-proposal-class-properties'), { loose: true }],
[require('@babel/plugin-proposal-private-methods'), { loose: true }]
)

// Transform runtime, but only for helpers
Expand Down

0 comments on commit 0b35ce5

Please sign in to comment.