When I use babel to compile js, the 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]
};
My entry js is just console.log(new Proxy());
, in chrome will call an error Uncaught ReferenceError: Proxy is not defined
.
I'm sure js
has been compiled, but why Proxy
is not defined after babel compiling?
Proxies are currently unsupported by babeljs.
From their website:
Unsupported feature
Due to the limitations of ES5, Proxies cannot be transpiled or polyfilled. See support in various JavaScript engines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With