From 4ac7948dcbeaa78cb9ca5c0459c984460c874824 Mon Sep 17 00:00:00 2001 From: vscaiceanu-1a <86055112+vscaiceanu-1a@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:45:28 +0200 Subject: [PATCH] fix: strip leading slash for resources --- src/index.ts | 2 +- src/templates/prefetch.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 85dfd2e1..d9ec95a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -124,7 +124,7 @@ export default createBuilder(async (options, context): Pr resourceArray: JSON.stringify(resourceArray), prefetchConfig: JSON.stringify(filterOptions(options, configOptions)), staticsFullPath: options.staticsFullPath, - localizationPattern: options.localizationPattern + localizationPattern: options.localizationPattern.replace(/^\/+/, '') }; const prefetchJs = Mustache.render(prefetchTemplate, variables); diff --git a/src/templates/prefetch.mustache b/src/templates/prefetch.mustache index c0c01b2c..38aa4a99 100644 --- a/src/templates/prefetch.mustache +++ b/src/templates/prefetch.mustache @@ -90,7 +90,7 @@ resList.forEach(function(resource) { if (typeof resource === 'string') { var fullPath = staticsFullPath; - if (hasDynamicContent && dynamicContentFiles.includes(resource.slice(1))) { + if (hasDynamicContent && dynamicContentFiles.includes(resource.replace(/^\/+/, ''))) { fullPath = dynamicContentPath + '/'; } var splitRes = resource.split('.');