44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import pkg from "./package.json";
|
|
import { execSync } from "child_process";
|
|
|
|
const gitCommitHash = (() => {
|
|
try {
|
|
return execSync("git rev-parse --short HEAD").toString().trim();
|
|
} catch {
|
|
return "unknown";
|
|
}
|
|
})();
|
|
|
|
const gitCommitTimeStamp = (() => {
|
|
try {
|
|
return execSync("git log -1 --format=%cd --date=iso").toString().trim();
|
|
} catch {
|
|
return "unknown";
|
|
}
|
|
})();
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
server: {
|
|
host: true,
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://100.72.72.70:8080",
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
base: "/Mobile",
|
|
define: {
|
|
__APP_NAME__: JSON.stringify(pkg.name),
|
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
__GIT_COMMIT__: JSON.stringify(gitCommitHash),
|
|
__GIT_TIMESTAMP__: JSON.stringify(gitCommitTimeStamp),
|
|
},
|
|
});
|
|
// Previous target: "http://100.118.196.113:8080",
|