Skip to main content

@babel/preset-stage-0

danger

从 Babel v7 开始,所有的阶段预设都已被弃用。查看 博客文章 获取更多信息。

有关升级说明,请参见自述文件。

🌐 For upgrade instructions, see the README. :::

安装​

🌐 Install

npm install --save-dev @babel/preset-stage-0

用法​

🌐 Usage

🌐 With a configuration file (Recommended)

babel.config.json
{
"presets": ["@babel/preset-stage-0"]
}

通过 CLI​

🌐 Via CLI

Shell
babel script.js --presets @babel/preset-stage-0

通过 Node API​

🌐 Via Node API

JavaScript
require("@babel/core").transformSync("code", {
presets: ["@babel/preset-stage-0"]
});

选项​

🌐 Options

loose​

boolean,默认值为 false。

为这个预设中允许的任何插件启用“宽松”转换。

🌐 Enable "loose" transformations for any plugins in this preset that allow them.

useBuiltIns​

boolean,默认值为 false。

会使用原生内置功能,而不是为任何需要它的插件尝试填补行为。

🌐 Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.

decoratorsLegacy​

boolean,默认值为 false。

使用旧版(阶段 1)装饰器语法和行为。

🌐 Use the legacy (stage 1) decorators syntax and behavior.

你可以在这里阅读更多关于配置预设选项的信息