Skip to main content

@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining

此错误修复插件转换可选的链接运算符以解决影响版本 8.0 到 9.0 的 V8 错误

¥This bugfix plugin transforms optional chaining operators to workaround a V8 bug affecting versions 8.0 to 9.0.

提示

该插件包含在 @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 install --save-dev @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining

用法

¥Usage

¥With a configuration file (Recommended)

babel.config.json
{
"plugins": ["@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining"]
}

通过 CLI

¥Via CLI

Shell
babel --plugins @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining script.js

通过 Node API

¥Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining"],
});