webpack.config.js:
{
test: /\.js[x]?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015-loose', 'stage-0'],
cacheDirectory: true,
//cacheIdentifier : '.babelrc',
plugins: ['transform-runtime']
}
}
js:
import "babel-polyfill";
class CC{
constructor(x, y) {
this.x = x;
this.y = y;
}
}
var c1 = new CC(1,2);
前辈门有没有遇到这种问题呢?
参考一下这篇文章:使用 ES6 的浏览器兼容性问题,我现在也在坑中,只能帮你到这儿了。