Babel 中文文档
  • 印记中文
  • 文档
  • 配置
  • 试用
  • 视频
  • 博客
  • 赞助
  • 团队
  • GitHub
Edit

@babel/plugin-transform-strict-mode

This plugin may be enabled via @babel/plugin-transform-modules-commonjs. If you wish to disable it you can either turn strict off or pass strictMode: false as an option to the commonjs transform.

Example

In

foo();

Out

"use strict";

foo();

Installation

npm install --save-dev @babel/plugin-transform-strict-mode

Usage

With a configuration file (Recommended)

{
  "plugins": ["@babel/plugin-transform-strict-mode"]
}

Via CLI

babel --plugins @babel/plugin-transform-strict-mode script.js

Via Node API

require("@babel/core").transformSync("code", {
  plugins: ["@babel/plugin-transform-strict-mode"],
});
  • Example
  • Installation
  • Usage
    • With a configuration file (Recommended)
    • Via CLI
    • Via Node API
Babel 中文文档
文档
学习 ES2015
社区
视频用户Stack OverflowSlack 频道Twitter
更多
博客GitHub 组织GitHub 仓库Website 仓库旧版网址 6.x旧版网址 5.x