fix(nuxt): send the component loader and not the name

This commit is contained in:
julien huang 2024-04-09 21:55:27 +02:00
parent d4bca6cd57
commit b3250e4a46
1 changed files with 2 additions and 1 deletions

View File

@ -74,9 +74,10 @@ export const loaderPlugin = createUnplugin((options: LoaderOptions) => {
if (lazy) {
// Temporary hardcoded check to verify runtime functionality
if (name === 'DelayedWrapperTestComponent') {
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
imports.add(genImport(clientDelayedComponentRuntime, [{ name: 'createLazyIOClientPage' }]))
identifier += '_delayedIO'
imports.add(`const ${identifier} = createLazyIOClientPage(${JSON.stringify(name)})`)
imports.add(`const ${identifier} = createLazyIOClientPage(__defineAsyncComponent(${genDynamicImport(component.filePath)}))`)
} else {
imports.add(genImport('vue', [{ name: 'defineAsyncComponent', as: '__defineAsyncComponent' }]))
identifier += '_lazy'