跳到主要内容

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

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

提示

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

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

Via CLI

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

Via Node API

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