vite-plugin-vue2 icon indicating copy to clipboard operation
vite-plugin-vue2 copied to clipboard

`template.transformAssetUrlsOptions.includeAbsolute: false` has no effect.

Open ascott18 opened this issue 3 years ago • 3 comments

This is the same issue as https://github.com/vitejs/vite/issues/4836 that was fixed by https://github.com/vitejs/vite/pull/6779 for Vue3.

The following configuration has no effect because it gets overwritten here:

createVuePlugin({
  template: {
    transformAssetUrlsOptions: {
      includeAbsolute: false,
    },
  },
}),

ascott18 avatar Sep 09 '22 00:09 ascott18

I have the same issue. Did you come up with a workaround @ascott18 ?

patrickdavey avatar Sep 13 '22 17:09 patrickdavey

I've got the same issue incorporating Vue 2.7 with Laravel, it's causing import errors on the absolute assets processed by vite. It's tossing me a console-level error complaining about importing a different MIMEtype as JavaScript.

Unless @ascott18 has a work-around, it might be worth looking into crafting a PR that fixes said issue.

ZeroThe2nd avatar Sep 13 '22 19:09 ZeroThe2nd

I've created PR #48 which basically applies the fix for the Vue3 plugin (switching the object unpacking around so user settings override the defaults instead of the other way around)

ZeroThe2nd avatar Sep 13 '22 20:09 ZeroThe2nd

If completely disabling asset transformation will work for your app, then you can do that ({ template: { transformAssetUrls: false, }, }), but beyond that I don't know of a workaround.

ascott18 avatar Sep 14 '22 18:09 ascott18

For Laravel devs who run into this issue despite having the newest version of the plugin - try transformAssetUrlsOptions: {...} instead of transformAssetUrls: {...}. The latter is from current Laravel docs, I guess it's for the Vue 3 plugin or something.

rafalglowacz avatar Jan 23 '23 09:01 rafalglowacz

For Laravel devs who run into this issue despite having the newest version of the plugin - try transformAssetUrlsOptions: {...} instead of transformAssetUrls: {...}. The latter is from current Laravel docs, I guess it's for the Vue 3 plugin or something.

@rafalglowacz worked fine for me. thanks

albanafmeti avatar May 18 '23 11:05 albanafmeti

Para los desarrolladores de Laravel que se encuentran con este problema a pesar de tener la versión más reciente del complemento, intente transformAssetUrlsOptions: {...}en lugar de transformAssetUrls: {...}. Este último es de los documentos actuales de Laravel, supongo que es para el complemento Vue 3 o algo así.

Muchas Gracias 🇨🇴 🙏 @rafalglowacz

carlosmolano avatar Jul 04 '23 06:07 carlosmolano