我尝试了多种变体,但它们似乎都没有效果。有什么想法吗?
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 code:
import "babel-polyfill";
class CC{
constructor(x, y) {
this.x = x;
this.y = y;
}
}
var c1 = new CC(1,2);
提前致谢。