(base)
| 3 | // behind a reverse proxy that strips the prefix, without impacting root installs. |
| 4 | |
| 5 | function normalizeBasePath(base) { |
| 6 | const b = String(base || '').trim(); |
| 7 | if (!b || b === '/') return ''; |
| 8 | const withSlash = b.startsWith('/') ? b : '/' + b; |
| 9 | return withSlash.replace(/\/+$/, ''); |
| 10 | } |
| 11 | |
| 12 | // Best-effort auto-detect from the *current URL* (works for /fr/, /fr/index.html, etc.). |
| 13 | export function getBasePath() { |