在webpack中移除严格模式

在webpack中移除严格模式需要用到babel插件

1. 下载插件$ npm install babel-plugin-transform-remove-strict-mode
  • 如果用的是CLI
$ babel --plugins transform-remove-strict-mode script.js
  • 如果用的是.babelrc中的配置为
.babelrc 文件添加配置

{
    "plugins": ["transform-remove-strict-mode"]
}
  • 如果用的是node API
require("babel-core").transform("code", {
  plugins: ["transform-remove-strict-mode"]
});

猜你喜欢

转载自blog.csdn.net/weixin_44145479/article/details/90024873
今日推荐