hi-frontend/apps/admin/vite.config.ts
web 3cf6a5cfb4 feat: update localization files and improve system version management
- Changed output path for i18next configuration in admin and user apps to "public/assets/locales/{{language}}/{{namespace}}.json".
- Added new translation keys in English and Chinese for admin and user updates in tool.json files.
- Refactored SystemVersionCard component to utilize new service version checking and updating logic.
- Introduced basic service version checking and updating functions in the gateway service.
- Added typings for new API endpoints related to service version management.
- Updated Vite configuration to rewrite API paths.
- Added TypeScript error handling in various service files.
2025-12-01 03:00:47 -08:00

58 lines
1.5 KiB
TypeScript

import { readFileSync, writeFileSync } from "node:fs";
import { fileURLToPath, URL } from "node:url";
import tailwindcss from "@tailwindcss/vite";
import { devtools } from "@tanstack/devtools-vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import viteReact from "@vitejs/plugin-react";
import { defineConfig, type Plugin } from "vite";
// Plugin to generate version.lock file after build
function versionLockPlugin(): Plugin {
return {
name: "version-lock",
apply: "build",
closeBundle() {
const distDir = fileURLToPath(new URL("./dist", import.meta.url));
const rootPkgPath = fileURLToPath(
new URL("../../package.json", import.meta.url)
);
const rootPkg = JSON.parse(readFileSync(rootPkgPath, "utf-8"));
const version = rootPkg.version || "0.0.0";
writeFileSync(`${distDir}/version.lock`, version);
},
};
}
// https://vitejs.dev/config/
export default defineConfig({
base: "./",
plugins: [
devtools({ eventBusConfig: { port: 42_070 } }),
tanstackRouter({
target: "react",
autoCodeSplitting: true,
}),
viteReact(),
tailwindcss(),
versionLockPlugin(),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
proxy: {
"/api": {
target: "https://api.ppanel.dev",
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
build: {
assetsDir: "static",
},
});