Babel没有编译For-of循环

时间:2016-04-28 08:43:54

标签: babel

我安装了 babel-preset-0 并将其包含在.babelrc文件中,我还安装了transform-runtime,请参阅下面的文件,但 对于 循环代码在编译时抛出错误

var mySet = new Set();

mySet.add(1);
mySet.add(5);
mySet.add("some text");

var myArr = [v for (v of mySet)];// throws error

Webpack.config.js

loaders: [
                { test: path.join(__dirname, 'es6'),
                  loader: 'babel-loader' ,
                   // Options to configure babel with
                  query: {
                    plugins: ['transform-runtime'],
                    presets: ['es2015', 'stage-0'],
                    cacheDirectory: true,
                        plugins: [
                          'transform-runtime',                         
                          'transform-decorators-legacy',
                        ],
                  },
                  exclude: [
                              path.resolve(__dirname, "node_modules"),
                            ]
              },

.babelrc

{
  "presets": ["es2015", "stage-0"],
  "plugins": ["transform-decorators-legacy"]
}

0 个答案:

没有答案