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

断了今生、忘了曾经 提交于 2019-12-18 16:55:20

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/52827968/babel-7-how-to-prevent-adding-of-strict-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!