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


  • Operating System: Darwin
  • Node Version: v20.17.0
  • Nuxt Version: 3.13.2
  • CLI Version: 3.13.2
  • Nitro Version: 2.9.7
  • Package Manager: npm@10.8.2
  • Builder: -
  • User Config: devtools, modules, app, i18n, icon, imports, runtimeConfig, vue, compatibilityDate, vite
  • Runtime Modules: @nuxtjs/storybook@8.3.0-28771560.b2b9b16, @nuxt/image@1.8.0, @pinia/nuxt@0.5.3, @nuxt/icon@1.5.1, @nuxtjs/i18n@8.5.3
  • Build Modules: -

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