From 72ddba1c069e4fa4dab4118adb2adabeea30b56d Mon Sep 17 00:00:00 2001 From: ashwinkumaragurubaran Date: Wed, 5 Aug 2026 15:13:25 +0530 Subject: [PATCH] build: make artifact placement-portable for frontend releases - vite base './' (relative asset refs) so one build serves any mount path - index.html carries placeholder + ./config.js ref - BASE_URL reads window.__RUNTIME_CONFIG__.VITE_ZINO_API_URL (placement- written) with a dev fallback Required by frontgen 1600 assertBuildOutput + the dev->qa frontend release model (target writes config.js from its own ZINO_API_URL). --- index.html | 2 ++ src/api/config.ts | 12 +++++++++++- vite.config.ts | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8e66ab3..6bb83ca 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,8 @@ Krishna Sales + +
diff --git a/src/api/config.ts b/src/api/config.ts index d710a3f..c5b543c 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -5,7 +5,17 @@ // docs under src/docs/api. export const APP_ID = '434'; -export const BASE_URL = 'https://dev.getzino.in'; + +// Backend URL comes from the runtime config.js the frontgen server writes at +// placement time (window.__RUNTIME_CONFIG__.VITE_ZINO_API_URL) so one built +// artifact can be promoted across environments. The dev literal is only a +// fallback for local dev / a build served without config.js. +declare global { + interface Window { __RUNTIME_CONFIG__?: Record } +} +export const BASE_URL = + (typeof window !== 'undefined' && window.__RUNTIME_CONFIG__?.VITE_ZINO_API_URL) || + 'https://dev.getzino.in'; // --- Order Booking (src/docs/api/order_booking.md) --- export const ORDER_BOOKING = { diff --git a/vite.config.ts b/vite.config.ts index d4880cf..ae7fe15 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,9 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' -const base = process.env.VITE_BASE_URL ?? '/krishna_sales' +// Relative base so the built artifact is mount-path agnostic; the target +// frontgen writes the real into index.html at placement time. +const base = './' export default defineConfig(() => ({ base,