mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxt3): don't rely on auto-imports for defineAsyncComponent
(#4454)
This commit is contained in:
parent
24923db992
commit
d469c9a6d7
@ -52,8 +52,8 @@ function transform (code: string, id: string, components: Component[], mode: Loa
|
||||
imports.add(genImport('#app/components/client-only', [{ name: 'createClientOnly' }]))
|
||||
}
|
||||
if (lazy) {
|
||||
// Nuxt will auto-import `defineAsyncComponent` for us
|
||||
imports.add(`const ${identifier}_lazy = defineAsyncComponent(${genDynamicImport(component.filePath)})`)
|
||||
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
|
||||
imports.add(`const ${identifier}_lazy = __defineAsyncComponent(${genDynamicImport(component.filePath)})`)
|
||||
return isClientOnly ? `createClientOnly(${identifier}_lazy)` : `${identifier}_lazy`
|
||||
} else {
|
||||
imports.add(genImport(component.filePath, [{ name: component.export, as: identifier }]))
|
||||
|
Loading…
Reference in New Issue
Block a user