I configure webpack and the error pops up

ERROR in ./es6/scripts.js 23:8 Module parse failed: Unexpected token (23:8) You may need an appropriate loader to handle this file type. | } | > tick=()=>{ | this.time--; | this.render();</code 

my .babelrc

 { "presets": [ "@babel/preset-env" ], "plugins": [ "@babel/plugin-proposal-class-properties" ] } 

my webpack.config.js

 let path = require('path'); let conf = { entry: './es6/scripts.js', output:{ path: path.resolve(__dirname,'./js'), filename: 'main.js', publicPath: 'js/' }, devServer: { overlay:true }, module: { rules:[ { test:'/\.js$/', loader: 'babel-loader', //exlude 'node_modules' } ] } }; module.exports = conf; 

my package.json

 { "name": "frontend", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "dev": "webpack-dev-server --mode development --open", "build": "webpack --mode production" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "@babel/core": "^7.4.4", "@babel/plugin-proposal-class-properties": "^7.4.4", "@babel/preset-env": "^7.4.4", "babel-loader": "^8.0.5", "webpack": "^4.31.0", "webpack-cli": "^3.3.2", "webpack-dev-server": "^3.3.1" } } 

    1 answer 1

    Try in the babel config (.babelrc include the react preset:
    https://babeljs.io/docs/en/babel-preset-react/

     { "presets": ["react"] }