empty path fix

This commit is contained in:
Anthony Stirling 2025-09-24 19:55:13 +01:00
parent 40fd5bb808
commit ea78f78760

View File

@ -7,7 +7,8 @@ export const getBaseUrl = (): string => {
};
// Base path from Vite config - build-time constant, normalized (no trailing slash)
export const BASE_PATH = (import.meta.env.BASE_URL || '/').replace(/\/$/, '');
// When no subpath, use empty string instead of '.' to avoid relative path issues
export const BASE_PATH = (import.meta.env.BASE_URL || '/').replace(/\/$/, '').replace(/^\.$/, '');
/** For in-app navigations when you must touch window.location (rare). */
export const withBasePath = (path: string): string => {