Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'assets' dir only run in index or with $img #429

Open
ga-devfront opened this issue Sep 24, 2021 · 1 comment
Open

'assets' dir only run in index or with $img #429

ga-devfront opened this issue Sep 24, 2021 · 1 comment

Comments

@ga-devfront
Copy link

ga-devfront commented Sep 24, 2021

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.

@blowsie
Copy link
Sponsor

blowsie commented Feb 14, 2024

I know there are some issues when using directories other than the root public dir
#1006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants