perf: optimize for some details and comments (#4030)
* perf: optimize for some details and comments * fix: test case * chore: update ci
This commit is contained in:
@@ -15,8 +15,8 @@ import { getCommonConfig } from './common';
|
||||
|
||||
function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
return defineConfig(async (config) => {
|
||||
const { appTitle, base, port, ...envConfig } = await loadAndConvertEnv();
|
||||
const options = await userConfigPromise?.(config);
|
||||
const { appTitle, base, port, ...envConfig } = await loadAndConvertEnv();
|
||||
const { command, mode } = config;
|
||||
const { application = {}, vite = {} } = options || {};
|
||||
const root = process.cwd();
|
||||
@@ -78,16 +78,16 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
|
||||
port,
|
||||
warmup: {
|
||||
// 预热文件
|
||||
clientFiles: ['./index.html', './src/{views,layouts}/*'],
|
||||
clientFiles: ['./index.html', './src/{views,layouts,router,store}/*'],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const mergedConfig = mergeConfig(
|
||||
const mergedCommonConfig = mergeConfig(
|
||||
await getCommonConfig(),
|
||||
applicationConfig,
|
||||
);
|
||||
return mergeConfig(mergedConfig, vite);
|
||||
return mergeConfig(mergedCommonConfig, vite);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -13,8 +13,8 @@ function defineLibraryConfig(userConfigPromise?: DefineLibraryOptions) {
|
||||
return defineConfig(async (config: ConfigEnv) => {
|
||||
const options = await userConfigPromise?.(config);
|
||||
const { command, mode } = config;
|
||||
const root = process.cwd();
|
||||
const { library = {}, vite = {} } = options || {};
|
||||
const root = process.cwd();
|
||||
const isBuild = command === 'build';
|
||||
|
||||
const plugins = await loadLibraryPlugins({
|
||||
@@ -52,8 +52,8 @@ function defineLibraryConfig(userConfigPromise?: DefineLibraryOptions) {
|
||||
plugins,
|
||||
};
|
||||
const commonConfig = await getCommonConfig();
|
||||
const mergedConfig = mergeConfig(commonConfig, packageConfig);
|
||||
return mergeConfig(mergedConfig, vite);
|
||||
const mergedConmonConfig = mergeConfig(commonConfig, packageConfig);
|
||||
return mergeConfig(mergedConmonConfig, vite);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user