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

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

Open
exophunk opened this issue Sep 20, 2024 · 0 comments
Open

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

exophunk opened this issue Sep 20, 2024 · 0 comments
Labels
type: bug Something isn't working

Comments

@exophunk
Copy link

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:

  • Make storybook respect baseURL?
  • As a workaround: pass custom nuxt config when starting app in storybook to not use baseUrl there?

Additional context

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

@exophunk exophunk added the type: bug Something isn't working label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant