babel 7 - how to prevent adding of “strict mode” [

2020-02-26 09:43发布

I looked at many posts but still cannot get this to work :(

I have .babelrc

{
  "comments": false,
  "presets": [
    ["@babel/env", {
      "targets": {
        "browsers": ["ios 7"]
      }
    }],
    ["minify"]
  ]
}

I want to tell babel to not add "use strict" (anywhere)

How is this done ?

标签: babeljs babel
1条回答
等我变得足够好
2楼-- · 2020-02-26 10:14

Babel assumes by default that files being transformed are ES modules. Since that is not the case for you, you'll want to tell it that. You can check out the docs for the "sourceType" option, but essentially you want to add:

"sourceType": "script"

in your Babel options.

查看更多
登录 后发表回答