How to remove global “use strict” added by babel

后端 未结 16 2278
不思量自难忘°
不思量自难忘° 2020-11-27 03:46

I\'m using function form of \"use strict\" and don\'t want global form which Babel adds after transpilation. The problem is I\'m using some libraries that aren\'t using \"us

16条回答
  •  执念已碎
    2020-11-27 04:25

    As it has already been mentioned for Babel 6, it's the transform-es2015-modules-commonjs preset which adds strict mode. In case you want to use the whole es2015 preset without module transformations, put this in your .babelrc file:

    {
      "presets": [
        ["es2015", { "modules": false }]
      ]
    }
    

    This will disable modules and strict mode, while keeping all other es2015 transformations enabled.

提交回复
热议问题