fix: production crash due to undefined import.meta.env by adding env utility and updating build script

This commit is contained in:
bipproduction
2026-02-07 17:03:42 +08:00
parent 0dd2aa17d6
commit 60457b1f2f
6 changed files with 39 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
import { redirect } from "@tanstack/react-router";
import { VITE_PUBLIC_URL } from "../utils/env";
/* ================================
* Types
@@ -21,7 +22,7 @@ type SessionResponse = {
async function fetchSession(): Promise<SessionResponse | null> {
try {
const baseURL = import.meta.env.VITE_PUBLIC_URL || window.location.origin;
const baseURL = VITE_PUBLIC_URL || window.location.origin;
const res = await fetch(`${baseURL}/api/session`, {
method: "GET",
credentials: "include",