vuetifyjs / nuxt-module

Zero-config Nuxt Module for Vuetify
https://nuxt.vuetifyjs.com/
MIT License
226 stars 22 forks source link

v-img images broken on nuxi dev mode #220

Closed sk8killer closed 7 months ago

sk8killer commented 7 months ago

In dev mode ssr = false. In prod mode ssr = true. This works (in dev and prod mode) : `<img src="~/assets/img/fond.jpg"

`

this works in prod mode but DOES NOT WORK in dev mode : `<v-img src="~/assets/img/fond.jpg"

`

The includeTransformAssetsUrls option is set to true in both modes.

I've been pulling my hair out for 1 hour. Please help !

userquin commented 7 months ago

@sk8killer Vuetify and Nuxt versions?

sk8killer commented 7 months ago

I found the mistake, sorry about that.

I forgot to include this line in nuxt.config.ts :

vite: { vue: { template: { transformAssetUrls } } }

this works now. Thank you for this wonderfull package !

userquin commented 7 months ago

you shouldn't need to include that entry, it is enabled by default in the vuetify nuxt module: it will add that entry for you

sk8killer commented 7 months ago

if I remove this entry, all my images are broken.

I use (in devDependencies) :

I didn't add vuetify. Should I ?

userquin commented 7 months ago

no, should install latest version, can you check installed vuetify and vuetify vite plugin versions?

(I mean, in the node_modules)

userquin commented 7 months ago

The transformAssetUrls comes from the vuetify vite plugin

sk8killer commented 7 months ago

these packages are installed :

userquin commented 7 months ago

that's weird, should be fine, I'm going to prepare a reproduction, I cannot reproduce it in the playground here...

userquin commented 7 months ago

https://stackblitz.com/edit/github-2nc5a9?file=package.json,app.vue,nuxt.config.ts

userquin commented 7 months ago

it seems a problem with vue or nuxt version, now nuxt.options.vite.vue.template.transformAssetUrls is not undefined, I'm going to merge them.

userquin commented 7 months ago

@sk8killer linked reproduction working on my local using linked PR, requested a review from Daniel, maybe I can release it tmr, in the meantime use your workaround, once released it should work without it.

imagen

userquin commented 7 months ago

@sk8killer can you try with v0.13.4 removing the workaround?

amari10-2 commented 4 months ago

@userquin hi. sorry for asking closed issue, but i just in the same situation.

config ssr = false

first tried with latest version.

using v-img, src used path of '/assets/xxx/yyy.png' starting with '@' or '~'. but not change to '/_nuxt/' and not viewable. (when used img tag viewable)

second tried with fix version of this issue

but same result as latest version.

confirmed viewable version

in this configuration, viewable assets.

userquin commented 4 months ago

Open a new issue 🙏 , I need to review latest changes in nuxt 3.12.* and fix the layers problem

amari10-2 commented 4 months ago

237

opend issue