Skip to content

Commit 437215c

Browse files
Merge pull request #1419 from AmadeusITGroup/fix/path-for-dyn-res-master
fix: strip leading slash for resources
2 parents 4b6f2c0 + 7a3d366 commit 437215c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default createBuilder<PrefetchBuilderSchema>(async (options, context): Pr
124124
resourceArray: JSON.stringify(resourceArray),
125125
prefetchConfig: JSON.stringify(filterOptions(options, configOptions)),
126126
staticsFullPath: options.staticsFullPath,
127-
localizationPattern: options.localizationPattern
127+
localizationPattern: options.localizationPattern.replace(/^\/+/, '')
128128
};
129129
const prefetchJs = Mustache.render(prefetchTemplate, variables);
130130

src/templates/prefetch.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
resList.forEach(function(resource) {
9191
if (typeof resource === 'string') {
9292
var fullPath = staticsFullPath;
93-
if (hasDynamicContent && dynamicContentFiles.includes(resource.slice(1))) {
93+
if (hasDynamicContent && dynamicContentFiles.includes(resource.replace(/^\/+/, ''))) {
9494
fullPath = dynamicContentPath + '/';
9595
}
9696
var splitRes = resource.split('.');

0 commit comments

Comments
 (0)