Skip to content

Commit 567f1d5

Browse files
JeffreyATWjarlef
authored andcommitted
Enable babel parameters/destructuring for all versions of Node (facebook#927)
* Enable babel parameters/destructuring for all versions of Node * Add more descriptive comment explaining plugin use
1 parent b18334f commit 567f1d5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ const plugins = [
2727
regenerator: true,
2828
// Resolve the Babel runtime relative to the config.
2929
moduleName: path.dirname(require.resolve('babel-runtime/package'))
30-
}]
30+
}],
31+
// The following two plugins are currently necessary to get
32+
// babel-preset-env to work with rest/spread. More info here:
33+
// https://github.com/babel/babel-preset-env#caveats
34+
// https://github.com/babel/babel/issues/4074
35+
// const { a, ...z } = obj;
36+
require.resolve('babel-plugin-transform-es2015-destructuring'),
37+
// const fn = ({ a, ...otherProps }) => otherProps;
38+
require.resolve('babel-plugin-transform-es2015-parameters')
3139
];
3240

3341
// This is similar to how `env` works in Babel:

packages/babel-preset-react-app/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
],
1313
"dependencies": {
1414
"babel-plugin-transform-class-properties": "6.11.5",
15+
"babel-plugin-transform-es2015-destructuring": "6.16.0",
16+
"babel-plugin-transform-es2015-parameters": "6.17.0",
1517
"babel-plugin-transform-object-rest-spread": "6.8.0",
1618
"babel-plugin-transform-react-constant-elements": "6.9.1",
1719
"babel-plugin-transform-react-jsx-self": "6.11.0",

0 commit comments

Comments
 (0)