You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -242,7 +252,7 @@ When set to `true`, `retry=${times}` will be added to the query when requesting,
242
252
243
253
When you want to customize query, you can pass a function, for example:
244
254
245
-
-**Example:** All assets requested do not contain query:
255
+
-**Example 1:** All assets requested do not contain query:
246
256
247
257
```js
248
258
pluginAssetsRetry({
@@ -254,7 +264,7 @@ pluginAssetsRetry({
254
264
});
255
265
```
256
266
257
-
-**Example:** If there is a query in some of the requested assets, you can read it with `originalQuery`:
267
+
-**Example 2:** If there is a query in some of the requested assets, you can read it with `originalQuery`:
258
268
259
269
```js
260
270
pluginAssetsRetry({
@@ -325,6 +335,80 @@ pluginAssetsRetry({
325
335
});
326
336
```
327
337
338
+
### rules
339
+
340
+
-**Type:**`RuntimeRetryOptions[]`
341
+
-**Default:**`undefined`
342
+
343
+
Configure multiple retry rules with different options. Each rule will be evaluated in order, and the first matching rule will be used for retry logic. This is useful when you have different retry requirements for different types of assets or domains.
344
+
345
+
When using `rules`, the plugin will:
346
+
347
+
1. Check each rule in order by `test``domain``type`
348
+
349
+
2. If the rule is matched, the rule's configuration will be used to retry
350
+
351
+
3. If no rule is matched, the resource will not be retried
352
+
353
+
Each rule supports all the same options as the top-level configuration, including `type`, `domain`, `max`, `test`, `crossOrigin`, `delay`, `onRetry`, `onSuccess`, and `onFail`.
354
+
355
+
-**Example 1:** Different retry strategies for different CDNs:
When you use Assets Retry plugin, the Rsbuild injects some runtime code into the HTML and [Rspack Runtime](https://rspack.dev/misc/glossary#runtime), then serializes the Assets Retry plugin config, inserting it into the runtime code. Therefore, you need to be aware of the following:
0 commit comments