Skip to content
Draft
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
6 changes: 6 additions & 0 deletions packages/webgal/src/Core/util/prefetcher/assetsPrefetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const uniqueAssetsByUrl = (assetList: Array<IAsset>) => {
});
};

const hasRuntimeInterpolation = (url: string) => /(?<!\\)\{.*?\}/.test(url);

const inferPrefetchAs = (assetType: fileType): string => {
switch (assetType) {
case fileType.background:
Expand Down Expand Up @@ -109,6 +111,10 @@ export const assetsPrefetcher = (assetList: Array<IAsset>, options: IAssetsPrefe
// return;
// }
const filteredAssetList = uniqueAssetsByUrl(assetList).filter((asset) => {
if (hasRuntimeInterpolation(asset.url)) {
logger.debug(`跳过包含运行时变量的资源预加载:${asset.url}`);
return false;
}
if (options.ignoreLineGate) {
return true;
}
Expand Down