From ec9bc605242b51c336da128c0af1d81bf2184154 Mon Sep 17 00:00:00 2001 From: Michal Radecki Date: Mon, 13 Dec 2021 12:14:46 +0100 Subject: [PATCH] fix(project): fix getPublicUrl for dev builds --- src/utils/domHelpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/domHelpers.ts b/src/utils/domHelpers.ts index c28aca2f6..e524e254c 100644 --- a/src/utils/domHelpers.ts +++ b/src/utils/domHelpers.ts @@ -7,10 +7,10 @@ export function getPublicUrl(url: string) { return url; } - const baseUrl = import.meta.env.SNOWPACK_PUBLIC_BASE_URL; + const baseUrl = import.meta.env.SNOWPACK_PUBLIC_BASE_URL || ''; const trimSlashes = (s: string) => s.replace(/^\/+|\/+$/g, ''); - return '/' + [baseUrl, url].map(trimSlashes).join('/'); + return (baseUrl ? '/' : '') + [baseUrl, url].map(trimSlashes).join('/'); } export default function scrollbarSize(recalc?: boolean) {