why do I have to put babel-presets inside .babelrc and webpack.config.js?

前端 未结 2 645
半阙折子戏
半阙折子戏 2021-02-01 16:38

Ok. I am bootstraping a simple app. I am using flow.js. Presets that I use are babel-preset-2015, babel-preset-react and babel-preset-stage-0. I have to put same presets inside

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 17:18

    Try and modify your Loaders like

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

提交回复
热议问题