2

I am trying to create custom alias but I get an error:

Invalid options in vue.config.js: "resolve" is not allowed

This is what I did: enter image description here

1 Answer 1

6

vue.config.js is for vue configuration for webpack you need to wrap your resolve with either configureWebpack or chainWebpack, something like:

// vue.config.js
const path = require('path');
module.exports = {
  configureWebpack: {
    resolve: {...you config...}
  }
}

configureWebpack can be also a function, from the docs:

If you need conditional behavior based on the environment, or want to directly mutate the config, use a function (which will be lazy evaluated after the env variables are set). The function receives the resolved config as the argument. Inside the function, you can either mutate the config directly, OR return an object which will be merged:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.