## Migration from `preset-env` and `plugin-transform-runtime` All the existig capabilities of `@babel/preset-env` and `@babel/plugin-transform-runtime` related to `core-js` are supported by the polyfill providers implemented in this repository. ### `core-js@3`
Old configuration New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 }, "useBuiltIns": "usage", "corejs": 3 }] ] } ``` ```json { "targets": { "firefox": 42 }, "presets": ["@babel/preset-env"], "plugins": [ ["polyfill-corejs3", { "method": "usage-global" }] ] } ```
Old configuration New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 }, "useBuiltIns": "entry", "corejs": 3 }] ] } ``` ```json { "targets": { "firefox": 42 }, "presets": ["@babel/preset-env"], "plugins": [ ["polyfill-corejs3", { "method": "entry-global" }] ] } ```
Old configuration New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 } }] ], "plugins": [ ["@babel/transform-runtime", { "corejs": 3 }] ] } ``` ```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 } }] ], "plugins": [ "@babel/transform-runtime", ["polyfill-corejs3", { "method": "usage-pure" }] ] } ``` **NOTE**: The "Old" config doesn't support targets for polyfills, but you'll likely want to enable them by moving the `targets` option to the top-level.
### `es-shims`
Old configuration (with core-js) New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 }, "useBuiltIns": "usage", "corejs": 3 }] ] } ``` ```json { "targets": { "firefox": 42 }, "presets": ["@babel/preset-env"], "plugins": [ ["polyfill-es-shims", { "method": "usage-global" }] ] } ```
Old configuration (with core-js) New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 } }] ], "plugins": [ ["@babel/transform-runtime", { "corejs": 3 }] ] } ``` ```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 } }] ], "plugins": [ "@babel/transform-runtime", ["polyfill-es-shims", { "method": "usage-pure", }] ] } ``` **NOTE**: The "Old" config doesn't support targets for polyfills, but you'll likely want to enable them by moving the `targets` option to the top-level.
### `core-js@2`
Old configuration New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 }, "useBuiltIns": "usage", "corejs": 2 }] ] } ``` ```json { "targets": { "firefox": 42 }, "presets": ["@babel/preset-env"], "plugins": [ ["polyfill-corejs2", { "method": "usage-global" }] ] } ```
Old configuration New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 }, "useBuiltIns": "entry", "corejs": 2 }] ] } ``` ```json { "targets": { "firefox": 42 }, "presets": ["@babel/preset-env"], "plugins": [ ["polyfill-corejs2", { "method": "entry-global" }] ] } ```
Old configuration New configuration
```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 } }] ], "plugins": [ ["@babel/transform-runtime", { "corejs": 2 }] ] } ``` ```json { "presets": [ ["@babel/preset-env", { "targets": { "firefox": 42 } }] ], "plugins": [ "@babel/transform-runtime", ["polyfill-corejs2", { "method": "usage-pure" }] ] } ``` **NOTE**: The "Old" config doesn't support targets for polyfills, but you'll likely want to enable them by moving the `targets` option to the top-level.