feat: support some configurations through the .env file

This commit is contained in:
vince
2024-07-09 23:43:08 +08:00
parent 2731a1ec96
commit 2406ca832b
10 changed files with 50 additions and 19 deletions

View File

@@ -31,7 +31,7 @@ function defineApplicationConfig(options: DefineApplicationOptions = {}) {
pwa: true,
turboConsole: false,
...(typeof application === 'function'
? application(config)
? await application(config)
: application),
});
@@ -71,7 +71,7 @@ function defineApplicationConfig(options: DefineApplicationOptions = {}) {
);
return mergeConfig(
mergedConfig,
typeof vite === 'function' ? vite(config) : vite,
typeof vite === 'function' ? await vite(config) : vite,
);
});
}

View File

@@ -22,7 +22,7 @@ function defineLibraryConfig(options: DefineLibraryOptions = {}) {
injectMetadata: true,
isBuild,
mode,
...(typeof library === 'function' ? library(config) : library),
...(typeof library === 'function' ? await library(config) : library),
});
const { dependencies = {}, peerDependencies = {} } =
@@ -54,7 +54,7 @@ function defineLibraryConfig(options: DefineLibraryOptions = {}) {
const mergedConfig = mergeConfig(commonConfig, packageConfig);
return mergeConfig(
mergedConfig,
typeof vite === 'function' ? vite(config) : vite,
typeof vite === 'function' ? await vite(config) : vite,
);
});
}