mirror of
https://dev.azure.com/tstanciu94/ReverseProxy/_git/ReverseProxy_Frontend
synced 2025-10-03 16:49:04 +03:00
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import viteTsconfigPaths from "vite-tsconfig-paths";
|
|
import checker from "vite-plugin-checker";
|
|
import { readFileSync } from "node:fs";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(() => {
|
|
// Read package.json for version info
|
|
const packageJson = JSON.parse(readFileSync("./package.json", "utf-8"));
|
|
|
|
return {
|
|
base: process.env.VITE_BASE_PATH ? `/${process.env.VITE_BASE_PATH}/` : "/",
|
|
plugins: [
|
|
react(),
|
|
viteTsconfigPaths(), // Enables TypeScript path mapping from tsconfig.json
|
|
checker({
|
|
typescript: true
|
|
})
|
|
],
|
|
server: {
|
|
port: 3000,
|
|
open: true
|
|
},
|
|
build: {
|
|
outDir: "build",
|
|
sourcemap: true
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": resolve(__dirname, "src")
|
|
}
|
|
},
|
|
define: {
|
|
// Expose app version and build date as Vite environment variables
|
|
"import.meta.env.VITE_APP_VERSION": JSON.stringify(packageJson.version),
|
|
"import.meta.env.VITE_APP_DATE": JSON.stringify(new Date().toISOString())
|
|
}
|
|
};
|
|
});
|