fix(build): serve config and manifest URLs under the router base path (13-07)
A /app/ build still fetched /config.json and /release-manifest.json and failed at boot. The config URL default and a root-relative profile manifest URL now follow VITE_ROUTER_BASE_PATH, and an explicit config URL outside the base fails the build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2ec59ad9ee
commit
e215c849fb
@@ -53,6 +53,17 @@ export async function generateRuntimeConfig(
|
||||
const supplied = environment[variable];
|
||||
if (supplied !== undefined && supplied !== "") draft[field] = supplied;
|
||||
}
|
||||
// 13-07. dist, and the release manifest in it, is served under the router
|
||||
// base path; a root-relative profile URL is rebased onto it.
|
||||
const basePath = environment["VITE_ROUTER_BASE_PATH"] || "/";
|
||||
const manifestUrl = draft["RELEASE_MANIFEST_URL"];
|
||||
if (
|
||||
typeof manifestUrl === "string" &&
|
||||
manifestUrl.startsWith("/") &&
|
||||
!manifestUrl.startsWith(basePath)
|
||||
) {
|
||||
draft["RELEASE_MANIFEST_URL"] = `${basePath}${manifestUrl.slice(1)}`;
|
||||
}
|
||||
const buildId = environment["VITE_BUILD_ID"] ?? "local-build";
|
||||
const releaseId = environment["RELEASE_ID"] ?? "local-release";
|
||||
draft["BUILD_ID"] = buildId;
|
||||
|
||||
Reference in New Issue
Block a user