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