0

If I use a baseUrl in vue.config.js eg. '/directory1' i also must have base: '/directory1' when setting up vue-router otherwise it will route to '/'.

I want to be able to reference baseUrl in my vue app so I can have base: baseUrl in my vue router setup, is this possible?

1 Answer 1

5

vue.config.js is just an exported object. There should be no problem in importing this object in your own code to read the baseUrl:

import { baseUrl } from './vue.config.js'

console.log(baseUrl);
Sign up to request clarification or add additional context in comments.

2 Comments

It's located outside src directory, so in development it works but I didn't think it would work in production, but I guess it does. Thanks alot for this easy solution :)
@infinity1975 webpack takes care of adding all the imported files into the final bundle

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.