I have set up react fullstack environment with webpack-middleware. I have some es6 syntax in my code but I get error while state without constructor or named arrow function. For example, I want to use semantic-ui for react sort table: https://react.semantic-ui.com/collections/table#table-example-sortable And while compiling I get this error: enter image description here
I thought it is because of wrong webpack setup I attached it below.
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './client/index.js',
output: {
path: '/',
filename: 'bundle.js'
},
module: {
rules: [
{
use: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'client/index.html'
})
]
};
.babelrc
{
"presets": ["env", "react", "es2015"]
}