@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
This bugfix plugin renames destructuring parameters to workaround a Safari bug affecting versions 10 to 16.2.
tip
This plugin is included in @babel/preset-env
. Set the bugfixes
option to true
so Babel will automatically enable this plugin for you when your targets
are affected by the browser bug.
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
yarn add --dev @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
pnpm add --save-dev @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression"]
}
Via CLI
Shell
babel --plugins @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression script.js
Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression"],
});