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('.');