@@ -23,11 +23,6 @@ const plugins = [
23
23
[ require . resolve ( 'babel-plugin-transform-react-jsx' ) , {
24
24
useBuiltIns : true
25
25
} ] ,
26
- // function* () { yield 42; yield 43; }
27
- [ require . resolve ( 'babel-plugin-transform-regenerator' ) , {
28
- // Async functions are converted to generators by babel-preset-latest
29
- async : false
30
- } ] ,
31
26
// Polyfills the runtime needed for async/await and generators
32
27
[ require . resolve ( 'babel-plugin-transform-runtime' ) , {
33
28
helpers : false ,
@@ -69,13 +64,10 @@ if (env === 'development' || env === 'test') {
69
64
}
70
65
71
66
if ( env === 'test' ) {
72
- // The following plugins are a temporary workaround because
73
- // `babel-plugin-transform-regenerator` apparently needs them
74
- // and `babel-preset-env` doesn't detect it.
75
- // https://github.com/facebookincubator/create-react-app/issues/1156
76
67
plugins . push . apply ( plugins , [
77
- require . resolve ( 'babel-plugin-transform-es2015-arrow-functions' ) ,
78
- require . resolve ( 'babel-plugin-transform-es2015-destructuring' ) ,
68
+ // We always include this plugin regardless of environment
69
+ // because of a Babel bug that breaks object rest/spread without it:
70
+ // https://github.com/babel/babel/issues/4851
79
71
require . resolve ( 'babel-plugin-transform-es2015-parameters' )
80
72
] ) ;
81
73
@@ -100,7 +92,13 @@ if (env === 'test') {
100
92
// JSX, Flow
101
93
require . resolve ( 'babel-preset-react' )
102
94
] ,
103
- plugins : plugins
95
+ plugins : plugins . concat ( [
96
+ // function* () { yield 42; yield 43; }
97
+ [ require . resolve ( 'babel-plugin-transform-regenerator' ) , {
98
+ // Async functions are converted to generators by babel-preset-latest
99
+ async : false
100
+ } ] ,
101
+ ] )
104
102
} ;
105
103
106
104
if ( env === 'production' ) {
0 commit comments