11import { gzip } from 'node:zlib'
22import type { NuxtTemplate } from '@nuxt/schema'
33import { isAbsolute , join , relative } from 'pathe'
4- import { genDynamicImport } from 'knitwork'
54import { compile as jsonSchemaToTypescript } from 'json-schema-to-typescript'
65import type { JSONSchema } from 'json-schema-to-typescript'
76import { pascalCase } from 'scule'
@@ -137,13 +136,10 @@ export const componentsManifestTemplate = (manifest: Manifest) => {
137136 return nuxt . options . dev || options . manifest . components . includes ( c . pascalName ) || c . global
138137 } )
139138 . reduce ( ( map , c ) => {
140- map [ c . pascalName ] = map [ c . pascalName ] || [
141- c . pascalName ,
142- `${ genDynamicImport ( isAbsolute ( c . filePath )
143- ? './' + relative ( join ( nuxt . options . buildDir , 'content' ) , c . filePath ) . replace ( / \b \. (? ! v u e ) \w + $ / g, '' )
144- : c . filePath . replace ( / \b \. (? ! v u e ) \w + $ / g, '' ) , { wrapper : false , singleQuotes : true } ) } `,
145- c . global ,
146- ]
139+ const importPath = isAbsolute ( c . filePath )
140+ ? './' + relative ( join ( nuxt . options . buildDir , 'content' ) , c . filePath ) . replace ( / \b \. (? ! v u e ) \w + $ / g, '' )
141+ : c . filePath . replace ( / \b \. (? ! v u e ) \w + $ / g, '' )
142+ map [ c . pascalName ] = map [ c . pascalName ] || [ c . pascalName , importPath , c . global ]
147143 return map
148144 } , { } as Record < string , unknown [ ] > )
149145
@@ -152,7 +148,7 @@ export const componentsManifestTemplate = (manifest: Manifest) => {
152148 const localComponents = componentsList . filter ( c => ! c [ 2 ] )
153149 return [
154150 // Export local components directly for SSR compatibility (fixes #3700)
155- ...localComponents . map ( ( [ pascalName , type ] ) => `export { default as ${ pascalName } } from ${ ( type as string ) . replace ( / ^ i m p o r t \( / , '' ) . replace ( / \) $ / , '' ) } ` ) ,
151+ ...localComponents . map ( ( [ pascalName , path ] ) => `export { default as ${ pascalName } } from ' ${ path } ' ` ) ,
156152 `export const globalComponents: string[] = ${ JSON . stringify ( globalComponents ) } ` ,
157153 `export const localComponents: string[] = ${ JSON . stringify ( localComponents . map ( c => c [ 0 ] ) ) } ` ,
158154 ] . join ( '\n' )
0 commit comments