Skip to content

Commit 1d4fdc2

Browse files
rgrochowiczTimer
authored andcommitted
Enable loose mode for class-properties (#4248)
* Enable loose mode for `class-properties` * Update comment to point to discussion Resolves #4263
1 parent 06176e1 commit 1d4fdc2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/babel-preset-react-app/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ module.exports = function(api, opts) {
9292
// don't work without it: https://github.com/babel/babel/issues/7215
9393
require('@babel/plugin-transform-destructuring').default,
9494
// class { handleClick = () => { } }
95-
require('@babel/plugin-proposal-class-properties').default,
95+
// Enable loose mode to use assignment instead of defineProperty
96+
// See discussion in https://github.com/facebook/create-react-app/issues/4263
97+
[
98+
require('@babel/plugin-proposal-class-properties').default,
99+
{
100+
loose: true,
101+
},
102+
],
96103
// The following two plugins use Object.assign directly, instead of Babel's
97104
// extends helper. Note that this assumes `Object.assign` is available.
98105
// { ...todo, completed: true }

0 commit comments

Comments
 (0)