davestewart/nuxt-content-assets

Nuxt Image - 404 errors with images in `public`

jvolker opened this issue · 4 comments

Background

I'm trying to use this with Nuxt Image according to the Readme: https://github.com/davestewart/nuxt-content-assets#nuxt-image-compatibility

Issue

When setting

// nuxt.config.ts
export default defineNuxtConfig({
  image: {
    dir: '.nuxt/content-assets/public'
  }
}

it seems that all images from public can not be resolved anymore and I'm getting this error in the browser console:
404 (IPX: File not found)

What would be the best approach to store images that belong globally to the whole site when using nuxt-content-assets and Nuxt Image?

Thanks a lot in advance!

It looks like moving all images from public to content without changing the src path for those images works.

Hey @jvolker,

Sorry to miss this.

Just to check; was this just a difference in expectation of where to store the image causing it not to work?

Is there something special that you want to do; i.e having the image global AND in content?

Any changes needed to NCA docs perhaps?

Thanks for getting back to me.

Is there something special that you want to do; i.e having the image global AND in content?

Maybe it's more of a question. I was wondering if there is a way to enable both directories at the same time. Where would you store images that are used globally, not necessarily for content?

Hey @jvolker ...

Note that from v1.4.0 onwards setup for Nuxt Image has changed; it now uses layers.

Also, v1.4.1 fixes a hard-to-track-down bug with Nuxt Image and Layers, and the format is slightly different. I'm releasing tomorrow (Apr 17) so Nuxt Image public + content image setup should finally be transparent and bug-free.