diff --git a/packages/cli/src/utils/prepareEntryFile.ts b/packages/cli/src/utils/prepareEntryFile.ts index f88550d9..823c9690 100644 --- a/packages/cli/src/utils/prepareEntryFile.ts +++ b/packages/cli/src/utils/prepareEntryFile.ts @@ -41,7 +41,7 @@ const generateContent = ( const name = makeCamelCase(key); if (dynamicImport) { list.push( - `'${key}': import('${packagePath}${packagePath.endsWith(componentFileAffix) ? '' : componentFileAffix}')`, + `'${key}': () => import('${packagePath}${packagePath.endsWith(componentFileAffix) ? '' : componentFileAffix}')`, ); } else { importDeclarations.push( diff --git a/runtime/vue3/page/main.ts b/runtime/vue3/page/main.ts index deb30939..02a85a38 100644 --- a/runtime/vue3/page/main.ts +++ b/runtime/vue3/page/main.ts @@ -33,10 +33,7 @@ const magicApp = createApp(AppComponent); magicApp.use(request); Object.entries(components).forEach(([type, component]: [string, any]) => { - magicApp.component( - `magic-ui-${type}`, - defineAsyncComponent(() => component), - ); + magicApp.component(`magic-ui-${type}`, defineAsyncComponent(component)); }); Object.values(plugins).forEach((plugin: any) => {