Open funkel1989 opened 3 years ago
no clue why what i did fixed this but i've found a solution. I think it has something to do with the way webpack transpiles dynamic file names from the asset folder. I'll just list a few examples on what works and what doesn't and someone else can figure out the why because i don't know why it works the way it works
working (not in a loop where the image is dynamic):
:src="require(`~/assets/placeholder.png`)"
not working inside dynamic image loop
:src="require(`${item.pathToImage}`)"
not working inside dynamic image loop
:src="require(`~/assets/${item.imageNameWithExtensions}`)"
Working inside loop where image is dynamic
:src="require(`~/assets/${item.imageNameOnly}.png`)"
working inside loop where image is static
src="~/assets/ImageName.png"
omg, you're a lifesaver @funkel1989! was stuck in this for days last week 🙏
@funkel1989 nice find.
@nuxtjs/vuetify@1.11.2
, nuxt@2.14.x
-> no issues with dynamic images in templates such as:
<v-img :src="require(`@/assets/${image}`)" />
@nuxtjs/vuetify@1.11.3
, nuxt@2.15.x
-> build errors as stated above
@timothycraig I am trying with vuetify3. But the statement require("@/assets/img/icons/a4.png") doesn't work.
Module version 1.11.3
Describe the bug During build an error is received as states below
This happens for all of my asset files. It can be resolved by removing the customVariables section in my vuetify config (see below). It is caused when i'm using an image in the assets folder in my html like this:
if i remove the require statement the issue also goes away. Not sure why this is an issue.
To Reproduce https://github.com/Battle-Line-Productions/battlesite-home << this is the repo i'm having the issue in.
Steps to reproduce the behavior:
Expected behavior Expect my assets to load correctly and be able to require an image