C
C
Coder3212017-01-30 12:26:17
JavaScript
Coder321, 2017-01-30 12:26:17

Babel not compiling in es5?

There is a small project that is going to webpack. Working with chrome, I did not immediately notice the problem, but when it came time to test cross-browser, everything fell apart. The problem is that babel doesn't compile to es5. Config:

const path = require('path');
const webpackUglifyJsPlugin = require('webpack-uglify-js-plugin');
module.exports = {
    context: path.join(__dirname, 'app'),
    entry: './main.js',
    output: {
        filename: 'bundle.js'
    },
    eslint: {
        failOnWarning: false,
        failOnError: true
    },
    resolve: {
        modulesDirectories: ['node_modules']
    },
    module: {
        preLoaders: [
            // Javascript
            {
                test: /\.jsx?$/,
                loader: 'eslint',
                exclude: /node_modules/
            }
        ],
        loaders: [{
            test: /\.js$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'babel-loader',
            query: {
                presets: ['es2015']
            }
        }]
    },

    plugins: [
        new webpackUglifyJsPlugin({
            cacheFolder: path.resolve(__dirname, './'),
            debug: true,
            minimize: true,
            sourceMap: false,
            output: {
                comments: false
            },
            compressor: {
                warnings: false
            }
        })
    ],
    devServer: {
        port: 1234,
        historyApiFallback: {
            index: './index.html'
        }
    }
}

Can anyone suggest what is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-01-30
@Coder321

At first glance, everything is correct. Are you sure it doesn't compile? Perhaps something like Array.find or other features not supported by IE are used in the code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question