webpack: syntax error with babel-loader

前端 未结 1 1407
北海茫月
北海茫月 2020-12-21 18:45

I\'m starting to learn react with a tutorial. But webpack is not working as expected.

So here is my simple webpack.conf.js file.

         


        
相关标签:
1条回答
  • 2020-12-21 19:08

    Babel 6 doesn't do anything by itself. In order to properly process JSX, you need to have the following in your .babelrc file:

    {
        "presets": ["react"]
    }
    

    Also, you need to make sure you install that preset using NPM:

    $ npm install --save-dev babel-core react react-dom babel-preset-react
    

    A good place to start is the official React getting started page

    0 讨论(0)
提交回复
热议问题