Q:

Vue baseUrl set in vue-router base

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?

A:

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);

