@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression
此错误修复插件重命名解构参数以解决影响版本 10 到 16.2 的 浏览器错误。
¥This bugfix plugin renames destructuring parameters to workaround a Safari bug affecting versions 10 to 16.2.
提示
该插件包含在 @babel/preset-env
中。将 bugfixes
选项 设置为 true
,这样当你的 targets
受到浏览器错误影响时,Babel 会自动为你启用此插件。
¥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"]
}
通过 CLI
¥Via CLI
Shell
babel --plugins @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression script.js
通过 Node API
¥Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression"],
});