riasvdv / laravel-mix-eslint

mix.eslint()
20 stars 5 forks source link

Error: Cannot find module 'eslint-webpack-plugin' #8

Open poppabear8883 opened 2 years ago

poppabear8883 commented 2 years ago

Simply followed the instructions via README and when I run npm run watch I receive the error.

Laravel 8.41

"vue": "^3.1.5",
"eslint": "^7.30.0",
"eslint-plugin-vue": "^7.13.0",
"laravel-mix": "^6.0.25",
"laravel-mix-eslint": "^0.2.0",
riasvdv commented 2 years ago

Seems like this plugin isn't compatible with laravel-mix v6, I'll gladly accept a PR if you get it working, otherwise I'll try to do this when I find some time. It's not a high priority for me as I don't use this anymore

jasperf commented 2 years ago

That is too bad. Was just doing research on possible setups with eslint webpack plugin and eslint and started thread at https://laracasts.com/discuss/channels/elixir/webpack-eslint-setups-with-laravel-mix-6 . Do think we need something like

.webpackConfig({
    plugins: [
     new ESLintPlugin(options)
      }),
    ],

to load plugins in new Laravel Mix 6, but not quite done with the research.

dillingham commented 2 years ago

Came to report this also

Aslam97 commented 2 years ago

You need to install eslint-webpack-plugin manually. see https://github.com/riasvdv/laravel-mix-eslint/blob/master/index.js#L9 According to laravel-mix documentation what is returned from dependencies() will be installed by mix if you run npm run dev or npx mix but i don't know why it doesn't auto install.

so after you run npm install laravel-mix-eslint --save-dev you need to install eslint-webpack-plugin run npm install eslint-webpack-plugin --save-dev and then follow with npx mix

dillingham commented 2 years ago

@Aslam97 good catch

Zhythero commented 2 years ago

Hi it seems that the eslint dependency is not auto installed too. Manually ran yarn add eslint --dev along with yarn add eslint-webpack-plugin --dev.

Zhythero commented 2 years ago

So for anyone encountering this issue in the future, do:

yarn add eslint eslint-webpack-plugin --dev

or the npm equivalent

jasperf commented 2 years ago

Yeah with eslint-webpack-plugin added this package does work. Just need to see how I can include prettier in the mix now but ESLint works well. Thanks @Zhythero and @Aslam97