2

I'm new to Babel and want to know how I can keep my ES6 classes while transpiling async/await to es6/5.

Every time I try to transpile and bundle it with Webpack, the classes, which are supported in Chrome 53, are transpiled backwards. Webpack.config.js

var path = require('path');
var webpack = require('webpack');
module.exports = {
 entry: ['babel-polyfill','./src/entry.js'],
 output: {
     path: path.resolve(__dirname, 'build'),
     filename: 'app.bundle.js',
     library:'bundle',
     libraryTarget:'umd'
 },
 module: {
     loaders: [
         {
             test: /\.js$/,
             exclude: ["./node_modules"],
             loader: 'babel-loader',
             query: {
                 presets: ['env'],
             }
         }
     ]
 },
 stats: {
     colors: true
 },
 devtool: 'source-map'
};

babelrc

{
"plugins": [
    ["babel-plugin-transform-builtin-extend", {
        globals: ["Error", "Array"]
    }]
],
"presets": [[
    "env", {
        "targets" : {
            "chrome" : 53
        },
        "useBuiltIns": true,
         "debug": true,
         "modules" : false,
    }]
],
}

I hope someone can help me.

(PS: I tried to use babel-plugin-transform-builtin-extend but is it ignored)

Sascha
  • 21
  • 2

0 Answers0