Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ const config = {
async viteFinal(newConfig) {
newConfig.plugins ??= []

// Fix: Nuxt's generated #internal/nuxt/paths (<buildDir>/paths.mjs) calls
// getAppConfig() during module evaluation (#build/fetch.mjs → baseURL()). Without an
// SSR payload, Nuxt's client useRuntimeConfig shim returns undefined and `.app`
// throws, so fall back to an empty config.
newConfig.plugins.unshift({
name: 'storybook-nuxt-paths-app-config',
enforce: 'pre',
transform(code, id) {
if (!/paths\.mjs(?:$|\?)/.test(id)) return
return code.replace(
'const getAppConfig = () => useRuntimeConfig().app',
'const getAppConfig = () => useRuntimeConfig()?.app ?? {}',
)
},
})

// Fix: nuxt:components:imports-alias relies on internal Nuxt state that is
// cleaned up after nuxt.close() in @storybook-vue/nuxt's loadNuxtViteConfig.
// When that state is gone, `import X from '#components'` is left unresolved
Expand Down
13 changes: 0 additions & 13 deletions patches/nuxt@4.5.2.patch

This file was deleted.

Loading
Loading