@@ -117,29 +117,29 @@ module.exports = function(api, opts, env) {
117
117
// Experimental macros support. Will be documented after it's had some time
118
118
// in the wild.
119
119
require ( 'babel-plugin-macros' ) ,
120
- // Necessary to include regardless of the environment because
121
- // in practice some other transforms (such as object-rest-spread)
122
- // don't work without it : https://github.com/babel/babel/issues/7215
123
- [
124
- require ( '@babel/plugin-transform-destructuring' ) . default ,
125
- {
126
- // Use loose mode for performance:
127
- // https://github.com/facebook/create-react-app/issues/5602
128
- loose : false ,
129
- selectiveLoose : [
130
- 'useState' ,
131
- 'useEffect' ,
132
- 'useContext' ,
133
- 'useReducer' ,
134
- 'useCallback' ,
135
- 'useMemo' ,
136
- 'useRef' ,
137
- 'useImperativeHandle' ,
138
- 'useLayoutEffect' ,
139
- 'useDebugValue' ,
140
- ] ,
141
- } ,
142
- ] ,
120
+ // Disabled as it's handled automatically by preset-env, and `selectiveLoose` isn't
121
+ // yet merged into babel: https://github.com/babel/babel/pull/9486
122
+ // Related : https://github.com/facebook/create-react-app/pull/8215
123
+ // [
124
+ // require('@babel/plugin-transform-destructuring').default,
125
+ // {
126
+ // // Use loose mode for performance:
127
+ // // https://github.com/facebook/create-react-app/issues/5602
128
+ // loose: false,
129
+ // selectiveLoose: [
130
+ // 'useState',
131
+ // 'useEffect',
132
+ // 'useContext',
133
+ // 'useReducer',
134
+ // 'useCallback',
135
+ // 'useMemo',
136
+ // 'useRef',
137
+ // 'useImperativeHandle',
138
+ // 'useLayoutEffect',
139
+ // 'useDebugValue',
140
+ // ],
141
+ // },
142
+ // ],
143
143
// Turn on legacy decorators for TypeScript files
144
144
isTypeScriptEnabled && [
145
145
require ( '@babel/plugin-proposal-decorators' ) . default ,
@@ -156,15 +156,6 @@ module.exports = function(api, opts, env) {
156
156
] ,
157
157
// Adds Numeric Separators
158
158
require ( '@babel/plugin-proposal-numeric-separator' ) . default ,
159
- // The following two plugins use Object.assign directly, instead of Babel's
160
- // extends helper. Note that this assumes `Object.assign` is available.
161
- // { ...todo, completed: true }
162
- [
163
- require ( '@babel/plugin-proposal-object-rest-spread' ) . default ,
164
- {
165
- useBuiltIns : true ,
166
- } ,
167
- ] ,
168
159
// Polyfills the runtime needed for async/await, generators, and friends
169
160
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
170
161
[
@@ -194,15 +185,6 @@ module.exports = function(api, opts, env) {
194
185
removeImport : true ,
195
186
} ,
196
187
] ,
197
- // Adds syntax support for import()
198
- require ( '@babel/plugin-syntax-dynamic-import' ) . default ,
199
- // Adds syntax support for optional chaining (?.)
200
- require ( '@babel/plugin-proposal-optional-chaining' ) . default ,
201
- // Adds syntax support for default value using ?? operator
202
- require ( '@babel/plugin-proposal-nullish-coalescing-operator' ) . default ,
203
- isEnvTest &&
204
- // Transform dynamic import to require
205
- require ( 'babel-plugin-dynamic-import-node' ) ,
206
188
] . filter ( Boolean ) ,
207
189
overrides : [
208
190
isFlowEnabled && {
0 commit comments