Skip to content

Commit 6a893a1

Browse files
committed
Merge branch 'main' of https://github.com/rspack-contrib/rsbuild-plugin-assets-retry into feat/support-muiltiple-rule
2 parents b91afbf + 75a62e0 commit 6a893a1

23 files changed

+52
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rsbuild/plugin-assets-retry",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"repository": "https://github.com/rspack-contrib/rsbuild-plugin-assets-retry",
55
"license": "MIT",
66
"type": "module",

src/runtime/initialChunkRetry.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@ function getRequestUrl(element: HTMLElement) {
4646
element instanceof HTMLScriptElement ||
4747
element instanceof HTMLImageElement
4848
) {
49+
// For <script src="" /> or <img src="" />
50+
// element.getAttribute('src') === '' but element.src === baseURI
51+
if (!element.getAttribute('src')) {
52+
return null;
53+
}
4954
return element.src;
5055
}
5156
if (element instanceof HTMLLinkElement) {
57+
// For <link href="" />
58+
if (!element.getAttribute('href')) {
59+
return null;
60+
}
5261
return element.href;
5362
}
5463
return null;

test/helper.ts renamed to test/basic/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { stripVTControlCharacters as stripAnsi } from 'node:util';
22
import type { Page } from '@playwright/test';
33
import { type RequestHandler, createRsbuild } from '@rsbuild/core';
44
import { pluginReact } from '@rsbuild/plugin-react';
5-
import { type PluginAssetsRetryOptions, pluginAssetsRetry } from '../dist';
5+
import { type PluginAssetsRetryOptions, pluginAssetsRetry } from '../../dist';
66

77
const portMap = new Map();
88

0 commit comments

Comments
 (0)