箭头函数未编译

Arrow functions not compiling

我一直在使用 Reactjs.net 和 Visual Studio,它编译包含 class 使用箭头函数语法定义的方法的 .jsx 文件...

class A {

   m = () => {
   }
}

我已经使用 ES2017 预设设置了 Webpack,但在方法名称后的等号处出现 "unexpected token" 错误。

为什么不能编译?

这是我的配置中的加载器部分...

module: {
        loaders: [
            {
                test: /.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                query: {
                    presets: ['es2017', 'react']
                }
            }
        ]
    }

我安装了https://babeljs.io/docs/plugins/preset-stage-2/

并在预设列表中添加了 'stage-2'。

我使用一些示例代码打开和关闭此处的预设后找到了这个解决方案...

https://babeljs.io/repl