This code does not compile as expected, but looking at examples around the web in should.
ERROR in ./src/main/javascript/app.js
Module build failed: SyntaxError: Unexpected token (66:18)
64 | }
65 |
> 66 | addErrorAlert = (title, message) => {
| ^
67 | this.state.toastContainer.error(
68 | message,
69 | title,
The method in question, it is actually part of a EM6 class extending React.Component
addErrorAlert = (title, message) => {
this.state.toastContainer.error(
message,
title,
{
timeOut: 10000,
extendedTimeOut: 10000,
preventDuplicates: true,
positionClass: "toast-bottom-full-width",
showMethod: "fadeIn",
hideMethod: "fadeOut"
}
);
};
WebPack config
var path = require('path');
var node_dir = __dirname + '/node_modules';
module.exports = {
entry: './src/main/javascript/app.js',
devtool: 'sourcemaps',
cache: true,
debug: true,
resolve: {
alias: {
'stompjs': node_dir + '/stompjs/lib/stomp.js',
}
},
output: {
path: __dirname,
filename: './src/main/resources/static/built/bundle.js'
},
module: {
loaders: [
{
test: path.join(__dirname, '.'),
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
presets: ['es2015', 'react']
}
}
]
}
};