davestewart / nuxt-content-assets

Enable locally-located assets in Nuxt Content
https://npmjs.com/package/nuxt-content-assets
108 stars 7 forks source link

Nuxt Image - 404 errors with images in `public` #46

Closed jvolker closed 2 months ago

jvolker commented 10 months ago

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!

jvolker commented 10 months ago

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

davestewart commented 9 months ago

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?

jvolker commented 9 months ago

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?

davestewart commented 2 months ago

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.