image
image copied to clipboard
'assets' dir only run in index or with $img
Hello everyone,
I actually work on Nuxt static site with nuxt-image. To optimize the loading of pages I am in the process of switching all our images to nuxt-image. However, I have a big problem. I can't figure out if it was me who set up nuxt-image incorrectly or if this is really a bug.
configuration
// package.json
"@nuxt/image": "^0.4.8"
"nuxt": "^2.14.7"
// nuxt.config.js
export default {
target: 'static',
buildModules: [
'@nuxt/image'
]
image: {
dir: 'assets'
}
}
problem description
In my page index.vue
then I make a <nuxt-picture>
all run right (in dev en generated mode) :
<nuxt-picture
loading="lazy"
src="images/clients/my-image.png"
alt="my alt"
sizes="xs:80 xl:120"
preset="logoClient"
width="120"
height="75"
/>
But then I try to switch simple <img>
to a <nuxt-picture>
in other .vue
file (like component.vue
) with same tag that's run on dev mode
but not after generation. No error will be desplayed in generation but then I watch the page the srcet
attritute point to images/clients/my-image.png
and not /_nuxt/image/[hash].webp
. I try to change the src
to ~/assets/images/clients/my-image.png
but that's not run in dev mode
and the generation do not use passed parameters (sizes, preset, format, ...).
Thanks in advance for reading me. Hoping to be able to solve this problem soon.
EDIT : I upgrade for 0.6.0
but the issue is the same.
I know there are some issues when using directories other than the root public dir https://github.com/nuxt/image/issues/1006