nuxt-Cannot read propertyeslint error

Insert picture description here

problem
在开发nuxt过程遇到了报错,希望大家下次遇到的时候可以迅速解决 报错信息如下 

Module build failed (from ./node_modules/eslint-loader/index.js):

Insert picture description here
Here you can see that there is a problem with eslint, so I found nuxt.config.js in the project, turned to the place where eslint-loader was assigned below, and
found that the original code is like this

build: {
    
    
    /*
     ** Run ESLINT on save
     */
    extend (config, ctx) {
    
    
      if (ctx.isClient) {
    
    
        config.module.rules.push({
    
    
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  }

Since isClient has been removed, you need to use Client, just use the following code

build: {
    /*
     ** Run ESLINT on save
     */
    extend (config, ctx) {
      if (ctx.Client) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  }

Run npm run dev again to solve the problem perfectly.
Insert picture description here
Thank you for watching, I hope it can solve the problem that everyone encountered

Guess you like

Origin blog.csdn.net/handsomezhanghui/article/details/108156923