Answer the question
In order to leave comments, you need to log in
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'
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question