@@ -183,6 +183,46 @@ const _module: NuxtModule<NuxtStoriesOptions> = defineNuxtModule<NuxtStoriesOpti
183183 // Remove app CSS from the shell to prevent style pollution — inherited by the frame via extends
184184 nuxt . options . css = [ ]
185185
186+ // Keys from the shell's nuxt config that must NOT be forwarded to the frame.
187+ // Everything else is inherited so that top-level options like `ssr`, `experimental`,
188+ // `app`, `vite`, etc. propagate automatically.
189+ const FRAME_EXCLUDED_CONFIG_KEYS = new Set ( [
190+ // Frame-incompatible or explicitly overridden below
191+ 'moduleDependencies' ,
192+ 'modules' ,
193+ 'css' ,
194+ 'extends' ,
195+ 'theme' ,
196+ 'rootDir' ,
197+ 'srcDir' ,
198+ 'buildDir' ,
199+ 'workspaceDir' ,
200+ 'stories' ,
201+ 'pages' ,
202+ 'nitro' ,
203+ // Nuxt internals
204+ '_layers' ,
205+ '_installedModules' ,
206+ '_modules' ,
207+ '_ignore' ,
208+ ] )
209+
210+ // Read the shell app's raw user config (first layer = the shell's own nuxt.config).
211+ // This gives us user-defined values before Nuxt merges in its defaults.
212+ const shellRawConfig = ( ( nuxt . options . _layers as unknown as Array < { config : Record < string , unknown > } > ) [ 0 ]
213+ ?. config ?? { } ) as Record < string , unknown >
214+
215+ const frameInheritedLines = Object . entries ( shellRawConfig )
216+ . filter ( ( [ key ] ) => ! FRAME_EXCLUDED_CONFIG_KEYS . has ( key ) )
217+ . flatMap ( ( [ key , value ] ) => {
218+ try {
219+ return [ ` ${ key } : ${ JSON . stringify ( value ) } ,` ]
220+ } catch {
221+ // Skip values that are not JSON-serializable (functions, class instances, etc.)
222+ return [ ]
223+ }
224+ } )
225+
186226 // Clear old .nuxt cache so the frame picks up the new config on restart
187227 const frameCacheDir = path . join ( frameTmpDir , '.nuxt' )
188228 if ( fs . existsSync ( frameCacheDir ) ) {
@@ -194,6 +234,8 @@ const _module: NuxtModule<NuxtStoriesOptions> = defineNuxtModule<NuxtStoriesOpti
194234 frameTmpConfig ,
195235 [
196236 `export default {` ,
237+ // Inherited shell options first — explicit entries below override them
238+ ...frameInheritedLines ,
197239 ` rootDir: ${ JSON . stringify ( frameTmpDir ) } ,` ,
198240 ` extends: [${ JSON . stringify ( frameAbsCwd ) } ],` ,
199241 ` modules: [${ JSON . stringify ( moduleEntry ) } ],` ,
0 commit comments