Skip to content

Commit

Permalink
fix(babel): loose option for babel class-properties and private-metho…
Browse files Browse the repository at this point in the history
…ds (#9232)
  • Loading branch information
clarkdo authored and danielroe committed May 11, 2021
1 parent ebd3ad2 commit c0f58e6
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 c0f58e6

Please sign in to comment.