build: make artifact placement-portable for frontend releases
- vite base './' (relative asset refs) so one build serves any mount path - index.html carries <!--BASE_HREF--> 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).
This commit is contained in:
parent
9ba93f6690
commit
72ddba1c06
@ -5,6 +5,8 @@
|
|||||||
<link rel="icon" type="image/png" href="/src/assets/logo.png" />
|
<link rel="icon" type="image/png" href="/src/assets/logo.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Krishna Sales</title>
|
<title>Krishna Sales</title>
|
||||||
|
<!--BASE_HREF-->
|
||||||
|
<script src="./config.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@ -5,7 +5,17 @@
|
|||||||
// docs under src/docs/api.
|
// docs under src/docs/api.
|
||||||
|
|
||||||
export const APP_ID = '434';
|
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<string, string> }
|
||||||
|
}
|
||||||
|
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) ---
|
// --- Order Booking (src/docs/api/order_booking.md) ---
|
||||||
export const ORDER_BOOKING = {
|
export const ORDER_BOOKING = {
|
||||||
|
|||||||
@ -2,7 +2,9 @@ import { defineConfig } from 'vite'
|
|||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
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 <base href> into index.html at placement time.
|
||||||
|
const base = './'
|
||||||
|
|
||||||
export default defineConfig(() => ({
|
export default defineConfig(() => ({
|
||||||
base,
|
base,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user