Webpack 4 issue with eslint

Problem

Unable to run eslint/eslint-loader when using Webpack 4, npm run dev results in this

Module build failed: TypeError: Cannot read property ‘eslint’ of undefined
at Object.module.exports (/Users/hanxue/PPP/jinrong/node_modules/eslint-loader/index.js:148:17)

Steps to reproduce

  1. Use the Vue.js webpack template at https://github.com/vuejs-templates/webpack
  2. Make the necessary changes to webpack.dev.conf.js and webpack.prod.conf.js per #6357
  3. npm run dev

My webpack configuration and package.json: https://gist.github.com/hanxue/e395d04d0d316d2f587174f5ebc91b74

Environment

Node: v8.4.0
webpack: 4.0.0-beta.2
vue: 2.5.2

Author: Fantashit

3 thoughts on “Webpack 4 issue with eslint

  1. eslint-loader seem to try to access this.options which was removed.

    As workaround use new webpack.LoaderOptionsPlugin({ options: {} })

  2. Thank you @sokra , adding the following to webpack.dev.conf.js made ESLint work with Webpack 4

    mode: "development",
      plugins: [
        new webpack.LoaderOptionsPlugin({ options: {} }),

Comments are closed.