diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 3df7a769c..593f2fa7d 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -151,7 +151,11 @@ export function relativeToSrcDir(config: AstroConfig, idOrUrl: URL | string) { return id.slice(slash(fileURLToPath(config.srcDir)).length); } -export function rootRelativePath(root: URL, idOrUrl: URL | string, prependSlash = true) { +export function rootRelativePath( + root: URL, + idOrUrl: URL | string, + shouldPrependForwardSlash = true +) { let id: string; if (typeof idOrUrl !== 'string') { id = unwrapId(viteID(idOrUrl)); @@ -162,7 +166,7 @@ export function rootRelativePath(root: URL, idOrUrl: URL | string, prependSlash if (id.startsWith(normalizedRoot)) { id = id.slice(normalizedRoot.length); } - return prependSlash ? prependForwardSlash(id) : id; + return shouldPrependForwardSlash ? prependForwardSlash(id) : id; } export function emoji(char: string, fallback: string) {