fix(cli): 异步组件返回应该是个函数

This commit is contained in:
roymondchen 2022-12-07 19:59:00 +08:00
parent ba20eb8cf1
commit 138614a57a
2 changed files with 2 additions and 5 deletions

View File

@ -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(

View File

@ -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) => {