How to set up Babel 6 stage 0 with React and Webpack

前端 未结 6 2059
抹茶落季
抹茶落季 2020-12-23 19:11

My understanding from the docs

I see that Babel 6 has three presets for now: es2015, react and stage-x. I read that I can set those in .babelrc like s

6条回答
  •  滥情空心
    2020-12-23 20:12

    Have you tried using just stage-1?

    Using query property worked for me.

    ```
    module: {
      loaders: [{
        test: /\.jsx?$/, 
        loader: 'babel',
        query: {
          presets: ['es2015', 'stage-1', 'react']
        }
      }]
    }
    ```
    

    Of course, I haven't been able to use .babelrc and babel options in package.json. Still trying to figure out babel-*v6.0

提交回复
热议问题