mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 17:32:31 +00:00
fix(nuxt): add missing import in islands template (#19870)
This commit is contained in:
parent
8b06b06a07
commit
c6f928d786
@ -92,13 +92,13 @@ export const componentsIslandsTemplate: NuxtTemplate<ComponentsTemplateContext>
|
|||||||
// .server components without a corresponding .client component will need to be rendered as an island
|
// .server components without a corresponding .client component will need to be rendered as an island
|
||||||
(component.mode === 'server' && !components.some(c => c.pascalName === component.pascalName && c.mode === 'client'))
|
(component.mode === 'server' && !components.some(c => c.pascalName === component.pascalName && c.mode === 'client'))
|
||||||
)
|
)
|
||||||
return islands.map(
|
return ['import { defineAsyncComponent } from \'vue\'', ...islands.map(
|
||||||
(c) => {
|
(c) => {
|
||||||
const exp = c.export === 'default' ? 'c.default || c' : `c['${c.export}']`
|
const exp = c.export === 'default' ? 'c.default || c' : `c['${c.export}']`
|
||||||
const comment = createImportMagicComments(c)
|
const comment = createImportMagicComments(c)
|
||||||
return `export const ${c.pascalName} = /* #__PURE__ */ defineAsyncComponent(${genDynamicImport(c.filePath, { comment })}.then(c => ${exp}))`
|
return `export const ${c.pascalName} = /* #__PURE__ */ defineAsyncComponent(${genDynamicImport(c.filePath, { comment })}.then(c => ${exp}))`
|
||||||
}
|
}
|
||||||
).join('\n')
|
)].join('\n')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user