Skip to content

Commit

Permalink
Enable babel parameters/destructuring for all versions of Node (faceb…
Browse files Browse the repository at this point in the history
…ook#927)

* Enable babel parameters/destructuring for all versions of Node

* Add more descriptive comment explaining plugin use
  • Loading branch information
JeffreyATW authored and feiqitian committed Oct 25, 2016
1 parent 8c3e0f7 commit d9d93d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/babel-preset-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ const plugins = [
regenerator: true,
// Resolve the Babel runtime relative to the config.
moduleName: path.dirname(require.resolve('babel-runtime/package'))
}]
}],
// The following two plugins are currently necessary to get
// babel-preset-env to work with rest/spread. More info here:
// https://github.com/babel/babel-preset-env#caveats
// https://github.com/babel/babel/issues/4074
// const { a, ...z } = obj;
require.resolve('babel-plugin-transform-es2015-destructuring'),
// const fn = ({ a, ...otherProps }) => otherProps;
require.resolve('babel-plugin-transform-es2015-parameters')
];

// This is similar to how `env` works in Babel:
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-preset-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
],
"dependencies": {
"babel-plugin-transform-class-properties": "6.11.5",
"babel-plugin-transform-es2015-destructuring": "6.16.0",
"babel-plugin-transform-es2015-parameters": "6.17.0",
"babel-plugin-transform-object-rest-spread": "6.8.0",
"babel-plugin-transform-react-constant-elements": "6.9.1",
"babel-plugin-transform-react-jsx-self": "6.11.0",
Expand Down

0 comments on commit d9d93d2

Please sign in to comment.