chore: trying to resolve default

This commit is contained in:
Michael Brevard 2024-04-09 23:47:41 +03:00 committed by GitHub
parent b3250e4a46
commit 8c1c23a422
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -77,7 +77,7 @@ export const loaderPlugin = createUnplugin((options: LoaderOptions) => {
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }])) imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
imports.add(genImport(clientDelayedComponentRuntime, [{ name: 'createLazyIOClientPage' }])) imports.add(genImport(clientDelayedComponentRuntime, [{ name: 'createLazyIOClientPage' }]))
identifier += '_delayedIO' identifier += '_delayedIO'
imports.add(`const ${identifier} = createLazyIOClientPage(__defineAsyncComponent(${genDynamicImport(component.filePath)}))`) imports.add(`const ${identifier} = createLazyIOClientPage(__defineAsyncComponent(${genDynamicImport(component.filePath, { interopDefault: false })}.then(c => c.${component.export ?? 'default'} || c)))`)
} else { } else {
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }])) imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
identifier += '_lazy' identifier += '_lazy'