template-vue
template-vue copied to clipboard
Fix alias path for vitejs in dev & prod env
When using imports using the @ alias it's broken because the config is inside vite/ folder.
So this pointing to a wrong path (./src):
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) // -> `root/vite/src/`
}
}
})
While it must be pointing to the correct path (../src):
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('../src', import.meta.url)) // -> `root/vite/../src/`
}
}
})