当我使用babel编译js时,config.js
var webpack = require('webpack');
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
module.exports = {
entry: {
Index: './index.js',
Test: './test.js'
},
output: {
path: __dirname,
filename: '[name].js' // Template based on keys in entry above
},
module: {
loaders: [
{
test: /\.js(x?)$/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
]
},
plugins: [commonsPlugin]
};
我的入口js只是console.log(new Proxy());
,在chrome中会报错Uncaught ReferenceError: Proxy is not defined
。
我确定js
已经编译好了,但是为什么babel编译后没有定义Proxy
?
最佳答案
babeljs 目前不支持代理。
来自他们的 website :
Unsupported feature
Due to the limitations of ES5, Proxies cannot be transpiled or polyfilled. See support in various JavaScript engines.
关于javascript - 我用babel编译js的时候没有定义Proxy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34960094/