From e9caf8da1f289cd92fb1a4a73ae38a193e06e309 Mon Sep 17 00:00:00 2001 From: Andy Adiwidjaja Date: Fri, 20 Sep 2024 12:52:40 +0200 Subject: [PATCH] Fixed url of vite resources in cases with and without base_url. --- src/Helper/ViteHelper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Helper/ViteHelper.php b/src/Helper/ViteHelper.php index 5955154..69322a1 100644 --- a/src/Helper/ViteHelper.php +++ b/src/Helper/ViteHelper.php @@ -7,6 +7,7 @@ use SilverStripe\ORM\FieldType\DBField; use SilverStripe\View\TemplateGlobalProvider; use SilverStripe\View\ViewableData; +use SilverStripe\Control\Director; class ViteHelper extends ViewableData implements TemplateGlobalProvider { @@ -85,7 +86,7 @@ public static function Vite($path, int $getCSSFile = null): string } else { $path = $outputUrl . $manifest[$path]['file']; } - return Convert::raw2att("/{$path}"); + return Convert::raw2att(Director::absoluteURL($path)); } }