Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default createBuilder<PrefetchBuilderSchema>(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);

Expand Down
2 changes: 1 addition & 1 deletion src/templates/prefetch.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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('.');
Expand Down