Import React from 'react' results in Uncaught SyntaxError: Unexpected identifier

旧城冷巷雨未停 提交于 2019-12-01 16:54:03

Try this : transform-es2015-modules-amd , This plugin transforms ES2015 modules to Asynchronous Module Definition (AMD).

{
    presets: ["env", "react"],
    plugins: ["transform-es2015-modules-amd"]
 }

more at transform-es2015-modules-amd

It is not working because it is not translating es6, so import statement is not working, Yo need to babel-preset-es2015

and configure it .babelrc

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