chore(@vant/cli): fix vue-router async component warning

This commit is contained in:
chenjiahan
2021-09-08 17:23:47 +08:00
committed by neverland
parent e20b05e10b
commit 0dfb594bd5
2 changed files with 4 additions and 19 deletions
@@ -83,7 +83,7 @@ function genImportDocuments(items: DocumentItem[]) {
.map((item) => {
const path = normalizePath(item.path);
if (isDev()) {
return `const ${item.name} = defineAsyncComponent(() => import('${path}'));`;
return `const ${item.name} = () => import('${path}');`;
}
return `import ${item.name} from '${path}';`;
})
@@ -113,8 +113,7 @@ export function genSiteDesktopShared() {
const dirs = readdirSync(SRC_DIR);
const documents = resolveDocuments(dirs);
const code = `import { defineAsyncComponent } from 'vue';
${genImportDocuments(documents)}
const code = `${genImportDocuments(documents)}
${genVantConfigContent()}