Skip to content

Commit

Permalink
Enable useBuiltIns option on object-rest-spread (facebook#902)
Browse files Browse the repository at this point in the history
* Enable useBuiltIns option on object-rest-spread

* note polyfill requirement

* Enable useBuiltIns with transform-react-jsx

* Add direct ref to transform-react-jsx
  • Loading branch information
existentialism authored and randycoulman committed May 8, 2017
1 parent efef1ba commit fae1b21
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/babel-preset-react-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ Then create a file named `.babelrc` with following contents in the root folder o
"presets": ["react-app"]
}
```

This preset uses the `useBuiltIns` option with [transform-object-rest-spread](http://babeljs.io/docs/plugins/transform-object-rest-spread/) and [transform-react-jsx](http://babeljs.io/docs/plugins/transform-react-jsx/), which assumes that `Object.assign` is available or polyfilled.
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 @@ -13,8 +13,16 @@ var path = require('path');
const plugins = [
// class { handleClick = () => { } }
require.resolve('babel-plugin-transform-class-properties'),
// The following two plugins use Object.assign directly, instead of Babel's
// extends helper. Note that this assumes `Object.assign` is available.
// { ...todo, completed: true }
require.resolve('babel-plugin-transform-object-rest-spread'),
[require.resolve('babel-plugin-transform-object-rest-spread'), {
useBuiltIns: true
}],
// Transforms JSX
[require.resolve('babel-plugin-transform-react-jsx'), {
useBuiltIns: true
}],
// function* () { yield 42; yield 43; }
[require.resolve('babel-plugin-transform-regenerator'), {
// Async functions are converted to generators by babel-preset-latest
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"babel-plugin-transform-class-properties": "6.16.0",
"babel-plugin-transform-object-rest-spread": "6.19.0",
"babel-plugin-transform-react-constant-elements": "6.9.1",
"babel-plugin-transform-react-jsx": "6.8.0",
"babel-plugin-transform-react-jsx-self": "6.11.0",
"babel-plugin-transform-react-jsx-source": "6.9.0",
"babel-plugin-transform-regenerator": "6.16.1",
Expand Down

0 comments on commit fae1b21

Please sign in to comment.