I'm having an issue with webpack
, specifically eslint-loader
.
I have a JS file, with code like:
class Test {
MyProp = "MyValue"
}
export default Test;
Initially, when I called npx eslint .
, I got:
D:\repro\src\main\js\index.js
3:12 error Parsing error: Unexpected token =
I've read somewhere I had to add "parser": "babel-eslint"
to .eslintrc for some reason.
That did fix the issue with npx eslint
, but I still have the issue with npx webpack
:
ERROR in ./src/main/js/index.js 3:11
Module parse failed: Unexpected token (3:11)
File was processed with these loaders:
* ./node_modules/eslint-loader/dist/cjs.js
I must have forgot some configuration somewhere, but I can't seem to find where.
To reproduce this, consider this repo:
https://github.com/slacaze/webpack-eslint-issue
npm install
npx eslint
=> No error (.eslintrc.json usesbabel-eslint
as parser)npx webpack
=> Error as above