nuxt-modules / storybook

Storybook integration with Nuxt.
https://storybook.nuxtjs.org
411 stars 95 forks source link

Using @nuxt/image does not work with baseURL #781

Open exophunk opened 2 months ago

exophunk commented 2 months ago

Environment


Reproduction

https://github.com/exophunk/nuxt-storybook-showcase

Describe the bug

Using the official Nuxt Image module does not work with storybook, when using a baseUrl like /my-base/. The images are broken, because the path can't be found. It does work on the page itself, but not in the stories.

is there anyway to configure nuxt + storybook + baseUrl + nuxtimage to work?

Reproduction Repo: https://github.com/exophunk/nuxt-storybook-showcase Stackblitz: https://stackblitz.com/~/github.com/exophunk/nuxt-storybook-showcase although on stackblitz, i'm never able to get this things run properly See the [NuxtImage](https://github.com/exophunk/nuxt-storybook-showcase/blob/main/components/NuxtIcon.stories.ts) story.

<NuxtImg src="/images/sb-nuxt-logo.jpg" />

Problem: image path is wrong

/my-base/_ipx/q_50&blur_3&s_30x20/images/sb-nuxt-logo.jpg is not found in storybook (localhost:6006) /my-base/_ipx/q_50&blur_3&s_30x20/images/sb-nuxt-logo.jpg works correctly in app (localhost:3000)

Is it possible to:

Additional context

The whole baseUrl stuff doesnt seem to run properly in stackblitz, you might be better off testing locally