Webpack + Babel error

前端 未结 2 1899
傲寒
傲寒 2021-01-28 05:12

I am trying to configure webpack and had everything up and running, but am now getting this same error. I\'ve combed through a few other posts that seem to have been resolved by

2条回答
  •  粉色の甜心
    2021-01-28 05:29

    You are using ES6 version of Javascript. You need preset config in webpack to understand and transpile that.

    Can you try adding following to your webpack module config?

     loaders : [
          {
            test:/\.jsx?$/,
            exclude:/node_modules/,
            loader: 'babel-loader',
            query:{
              presets: ['es2015','react','stage-0']
            }
          },
          // ... 
       ]
    

提交回复
热议问题