Babel 6 react JSX transformer - disable strict

放肆的年华 提交于 2019-11-30 17:26:47

According to this line, the strictMode option is indeed parsed.

I don't understand the syntax you used for your .babelrc, though. Why an array?

Try this:

{
  "plugins": [
    ["transform-react-jsx"]
  ],
  "sourceMaps": true,
  "strictMode": false
}

transform-strict-mode is used only to include the strict mode not to disable it. So setting it to false ["transform-strict-mode", {"strict": false}] will change nothing, in your case better remove this plug-in then including it. But if somewhere else you are using a plugin or preset that includes the strict mode, try maybe to use es2015-loose :

  1. install

    npm install --save-dev babel-preset-es2015-loose babel-preset-es2015

  2. config

    {"presets": ["es2015-loose"]}

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