Reply To: Solving Path Problems When Deploying Vue.js in Subdirectories

Forums How to solve Solving Path Problems When Deploying Vue.js in Subdirectories Reply To: Solving Path Problems When Deploying Vue.js in Subdirectories

#9392
albanaavdiu
Participant

In Vue 3, the ‘base‘ option is used to specify the base URL for all relative URLs in your application. This is useful when your Vue application is not deployed at the root of your domain but in a subdirectory.

(In VUE 2 assetsPublicPath: ‘/markataepeshkut’)

(In VUE 3 base: ‘/markataepeshkut’)

 

vite.config.ts

import { fileURLToPath, URL } from ‘node:url’

import { defineConfig } from ‘vite’
import vue from ‘@vitejs/plugin-vue’

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
base: ‘/markataepeshkut/’,
resolve: {
alias: {
‘@’: fileURLToPath(new URL(‘./src’, import.meta.url))
}
}
})