perf: Improve the global loading display

This commit is contained in:
vben
2024-06-02 23:50:58 +08:00
parent e650a0b863
commit 77d40dc763
14 changed files with 111 additions and 57 deletions

View File

@@ -1,7 +1,6 @@
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { fs } from '@vben/node-utils';
import { defineApplicationConfig } from './application';
import { defineLibraryConfig } from './library';
@@ -18,13 +17,19 @@ function defineConfig(options: DefineConfig = {}) {
// 根据包是否存在 index.html,自动判断类型
if (type === 'auto') {
const htmlPath = join(process.cwd(), 'index.html');
projectType = fs.existsSync(htmlPath) ? 'appcation' : 'library';
projectType = existsSync(htmlPath) ? 'application' : 'library';
}
if (projectType === 'appcation') {
return defineApplicationConfig(defineOptions);
} else if (projectType === 'library') {
return defineLibraryConfig(defineOptions);
switch (projectType) {
case 'application': {
return defineApplicationConfig(defineOptions);
}
case 'library': {
return defineLibraryConfig(defineOptions);
}
default: {
throw new Error(`Unsupported project type: ${projectType}`);
}
}
}