fix: 修复Admin构建标题变量注入失败
This commit is contained in:
parent
7cacedecc0
commit
506456b01b
@ -91,9 +91,10 @@ async function loadApplicationPlugins(
|
||||
): Promise<PluginOption[]> {
|
||||
// 单独取,否则commonOptions拿不到
|
||||
const isBuild = options.isBuild;
|
||||
const env = options.env;
|
||||
const env = options.env ?? {};
|
||||
|
||||
const {
|
||||
appTitle,
|
||||
archiver,
|
||||
archiverPluginOptions,
|
||||
compress,
|
||||
@ -194,7 +195,21 @@ async function loadApplicationPlugins(
|
||||
},
|
||||
{
|
||||
condition: !!html,
|
||||
plugins: () => [viteHtmlPlugin({ minify: true })],
|
||||
plugins: () => [
|
||||
viteHtmlPlugin({
|
||||
inject: {
|
||||
data: {
|
||||
...env,
|
||||
VITE_APP_TITLE:
|
||||
env.VITE_APP_TITLE ||
|
||||
process.env.VITE_APP_TITLE ||
|
||||
appTitle ||
|
||||
'Vben Admin Antdv Next',
|
||||
},
|
||||
},
|
||||
minify: true,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
condition: isBuild && importmap,
|
||||
|
||||
@ -183,6 +183,11 @@ interface CommonPluginOptions {
|
||||
* @description 用于配置应用构建时的插件选项
|
||||
*/
|
||||
interface ApplicationPluginOptions extends CommonPluginOptions {
|
||||
/**
|
||||
* 应用标题
|
||||
* @description 用于 HTML 模板和 PWA 配置的默认标题
|
||||
*/
|
||||
appTitle?: string;
|
||||
/**
|
||||
* 是否开启压缩归档
|
||||
* @default false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user