fix: 前端打包时增加git hash 信息

This commit is contained in:
Gsh
2026-01-18 23:45:48 +08:00
parent 8b183e289c
commit b0d1820919
3 changed files with 24 additions and 0 deletions

View File

@@ -10,12 +10,14 @@ import Components from 'unplugin-vue-components/vite';
import viteCompression from 'vite-plugin-compression';
import envTyped from 'vite-plugin-env-typed';
import gitHashPlugin from './git-hash';
import createSvgIcon from './svg-icon';
const root = path.resolve(__dirname, '../../');
function plugins({ mode, command }: ConfigEnv): PluginOption[] {
return [
gitHashPlugin(),
UnoCSS(),
envTyped({
mode,

View File

@@ -26,6 +26,17 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.use(store);
// 输出构建信息
console.log(
`%c 意心AI 3.3 %c Build Info `,
'background:#35495e; padding: 4px; border-radius: 3px 0 0 3px; color: #fff',
'background:#41b883; padding: 4px; border-radius: 0 3px 3px 0; color: #fff',
);
// console.log(`🔹 Git Branch: ${__GIT_BRANCH__}`);
console.log(`🔹 Git Commit: ${__GIT_HASH__}`);
// console.log(`🔹 Commit Date: ${__GIT_DATE__}`);
// console.log(`🔹 Build Time: ${__BUILD_TIME__}`);
// 挂载 Vue 应用
// mount 完成说明应用初始化完毕,此时手动通知 loading 动画结束
app.mount('#app');

View File

@@ -1 +1,12 @@
declare module "virtual:svg-icons-register";
// Git 构建信息
declare const __GIT_HASH__: string;
declare const __GIT_BRANCH__: string;
declare const __GIT_DATE__: string;
declare const __BUILD_TIME__: string;
// 全局加载器方法
interface Window {
__hideAppLoader?: () => void;
}