Vuetify Vue 3 alias path have been changed

Viewed 18

I have added to my vue 3 project vuetify via vue add.

This type of insertion <img src="@/assets/more-btn.svg" alt="" /> doesn't work, logs 404, shows path localhost:8080/@/assets/more-btn.svg instead of <img src="/img/add-btn.7b3be03d.svg" alt="">.

Kinda fixed it with <img :src="require('@/assets/more-btn.svg')" alt="" />.

How can i also add aliases, so everything was working as before? Any additions to add to aliases config?

1 Answers

you can add the alias config to your vite config

import { fileURLToPath, URL } from 'url';
export default defineConfig({
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
});
Related