vuetifyjs / vuetify-loader

📦 Webpack and Vite plugins for treeshaking Vuetify components and more
https://vuetifyjs.com/customization/a-la-carte#vuetify-loader
MIT License
516 stars 91 forks source link

[Feature Request] Vite plugin - automatic alias support (transformAssetUrls) #237

Closed TechAkayy closed 2 years ago

TechAkayy commented 2 years ago

Problem to solve

Adding this feature request based on @KaelWD's advise on discord (https://discord.com/channels/340160225338195969/660898563139567625/927090271068491856) about having vuetify vite plugin to automatically support 'transformAssetUrls'.

Current workaround is to define 'transformAssetUrls' in the vite.config.js manually for a list of components like this:

vue({
  template: {
    transformAssetUrls: {
      'v-img': ['src', ':src'],
      'v-parallax': ['src'],
      // other tags.... 
    }
  }
}),

https://stackblitz.com/github/TechAkayy/vuetify3-beta-alias-support (v-img doesn't show, unless comments in vite.config.js for transformAssetUrls inside vue() are removed)

Proposed solution

Support alias resolution automatically for all vuetify tags via vite-plugin-vuetify

KaelWD commented 2 years ago

Couldn't be done automatically in vite, so I added it as an export instead.

vue({ 
  template: { transformAssetUrls }
}),