diff --git a/src/utils.ts b/src/utils.ts index 64fa6f39..83abc902 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -3,11 +3,18 @@ export function slash(str: string) { } export function resolveBasePath(base: string) { - if (isAbsolute(base)) - return base - return (!base.startsWith('/') && !base.startsWith('./')) - ? `/${base}` - : base + let basePath = base + + if (!basePath.endsWith('/')) + basePath = `${basePath}/` + + if (isAbsolute(basePath)) + return basePath + + if (!basePath.startsWith('/') && !basePath.startsWith('./')) + basePath = `/${basePath}` + + return basePath } export function isAbsolute(url: string) {