Skip to content

Commit

Permalink
docs(transform-runtime): document overriding corejs definitions
Browse files Browse the repository at this point in the history
Documents the proposed feature babel/babel#10069.
  • Loading branch information
devinus committed Jun 9, 2019
1 parent bf903de commit 88f79ee
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docs/plugin-transform-runtime.md
Expand Up @@ -89,7 +89,7 @@ require("@babel/core").transform("code", {

### `corejs`

`false`, `2`, `3` or `{ version: 2 | 3, proposals: boolean }`, defaults to `false`.
`false`, `2`, `3` or `{ version: 2 | 3, proposals: boolean, definitions?: Object }`, defaults to `false`.

e.g. `['@babel/plugin-transform-runtime', { corejs: 3 }],`

Expand All @@ -106,6 +106,36 @@ This option requires changing the dependency used to provide the necessary runti
| `2` | `npm install --save @babel/runtime-corejs2` |
| `3` | `npm install --save @babel/runtime-corejs3` |

If needed, you can customize the `core-js` polyfill definitions that `@babel/plugin-transform-runtime` uses during transformations by specifying the `definitions` key to override [the defaults](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-runtime/src/runtime-corejs3-definitions.js).

For example, to disable polyfilling the `Symbol` built-in, all Array static methods and `String.prototype.repeat` instance method:

```json
{
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": {
"version": 3,
"definitions": {
"BuiltIns": {
"Symbol": false
},
"StaticProperties": {
"Array": false
},
"InstanceProperties": {
"repeat": false
}
}
}
}
]
]
}
```

### `helpers`

`boolean`, defaults to `true`.
Expand Down

0 comments on commit 88f79ee

Please sign in to comment.