ERROR in ./reducers/navigator.js
Module build failed: SyntaxError: C:/Users/Myname/Desktop/Projects/Project2/app/templates/reducers/navigator.js: Unexpected token (11:16)
9 | case SWITCH_PAGE:
10 | return {
> 11 | ...state,
| ^
12 | id : action.payload
13 | }
14 | default:
My webpack configuration looks like this
const webpack = require('webpack');
const config = {
entry: __dirname + '/index.jsx',
output: {
path: 'C:\\Users\\Myname\\Desktop\\Projects\\Project2\\app\\static\\js\\dist',
filename: 'bundle.js',
},
resolve: {
extensions: ['.js', '.jsx', '.css']
},
module: {
rules: [
{
test: /\.jsx?/,
exclude: /node_modules/,
use: 'babel-loader',
}
]
},
};
module.exports = config;
When i compile the app, it says this error and thats because this file is not processed by babel. Is there a way to return the state without ES6? or even better how can i make this compile with babel so i can have support to ES6 features.
Notes: index.jsx is the Parent component and others are childs
also my package.json contains this
"babel": {
"presets": [
"es2015",
"react"
]
},