Home

Issue: 1443

Multiple extend blocks in nuxt.config.js

[issue link]

With multiple extend blocks in nuxt.config.js only the last one works yet we get no error.

Here the ~vars alias works. But we have no linting on save. No error.

build: {
    // Run ESLINT on save
    extend(config, ctx) {
      if (ctx.dev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    },
    // Add ~vars alias for global SCSS settings
    extend(config) {
      config.resolve.alias['vars'] = path.join(__dirname, 'assets/scss/_vars.scss')
      config.resolve.alias['~vars'] = path.join(__dirname, 'assets/scss/_vars.scss')
    }
}

This works fine:

build: {
    // Run ESLINT on save
    extend (config, ctx) {
      if (ctx.dev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
      // Add ~vars alias for global SCSS settings
      config.resolve.alias['vars'] = path.join(__dirname, 'assets/scss/_vars.scss')
      config.resolve.alias['~vars'] = path.join(__dirname, 'assets/scss/_vars.scss')
    }
}

Maybe not an issue at all and it was intended to work like this. Sorry to waste your time if so.

This question is available on Nuxt.js community (#c1284)