Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I use babel to compile js, Proxy is not defined

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?

like image 720
qiuyuntao Avatar asked Sep 11 '25 16:09

qiuyuntao


1 Answers

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.

like image 131
rossipedia Avatar answered Sep 13 '25 05:09

rossipedia