template-vue icon indicating copy to clipboard operation
template-vue copied to clipboard

Fix alias path for vitejs in dev & prod env

Open Andrek25 opened this issue 1 year ago • 0 comments

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/`
    }
  }
})

Andrek25 avatar Aug 15 '24 21:08 Andrek25