up 更新web端依赖包版本,修复潜在错误

This commit is contained in:
孟帅
2024-08-27 17:37:23 +08:00
parent 6cf80ed0fe
commit 33e5252516
11 changed files with 51 additions and 136 deletions

View File

@@ -2,10 +2,7 @@
* Plugin to minimize and use ejs template syntax in index.html.
* https://github.com/anncwb/vite-plugin-html
*/
import type { Plugin } from 'vite';
import html from 'vite-plugin-html';
import { createHtmlPlugin } from 'vite-plugin-html';
import pkg from '../../../package.json';
import { GLOB_CONFIG_FILE_NAME } from '../../constant';
@@ -18,25 +15,24 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
};
const htmlPlugin: Plugin[] = html({
return createHtmlPlugin({
minify: isBuild,
inject: {
// Inject data into ejs template
injectData: {
data: {
title: VITE_GLOB_APP_TITLE,
},
// Embed the generated app.config.js file
tags: isBuild
? [
{
tag: 'script',
attrs: {
src: getAppConfigSrc(),
},
{
tag: 'script',
attrs: {
src: getAppConfigSrc(),
},
]
},
]
: [],
},
});
return htmlPlugin;
}