[英]Remove Global "use strict' from babel-preset-env
I want to remove the global 'use strict' that babel-preset-env adds with babel 6.x. 我想删除babel-preset-env与babel 6.x一起添加的全局'use strict'。
I read the other post about es2015. 我读了关于es2015的另一篇文章。
I've tried the following .babelrc configuration, to no avail: 我尝试了以下.babelrc配置,无济于事:
{
"presets": [["env", {"loose":true}]],
"plugins": [
["transform-es2015-modules-commonjs", {
"strict" : false
}]
]
}
I do not want to edit the actual file in node_modules as the other post suggested for es2015. 我不想像在es2015中建议的其他帖子一样编辑node_modules中的实际文件。 That's quite a hack and won't persist.
这是一个非常黑客,不会坚持下去。
The only solution so far is to use gulp-iife to wrap every file. 到目前为止,唯一的解决方案是使用gulp-iife来包装每个文件。 Is there really no way to pass an option in my .babelrc file to disable this?
真的没有办法在我的.babelrc文件中传递一个选项来禁用它吗?
Which plugin in 'env' is even doing this? 'env'中的哪个插件甚至可以这样做?
Thanks 谢谢
Set the modules
option of the env
preset to false
: 将
env
预设的modules
选项设置为false
:
{
"presets": [
["env", { "modules": false }]
]
}
From babel documentation : 来自babel文档 :
modules
模块
"amd" | "umd" | "systemjs" | "commonjs" | false
"amd" | "umd" | "systemjs" | "commonjs" | false
, defaults to"commonjs"
."amd" | "umd" | "systemjs" | "commonjs" | false
,默认为"commonjs"
。Enable transformation of ES6 module syntax to another module type.
启用将ES6模块语法转换为其他模块类型。
Setting this to false will not transform modules.
将此设置为false将不会转换模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.