Objectoutput.assetsRetry is used to configure the retry of assets.The type of AssetsRetryOptions is as follows:
undefinedSince the ability will inject some extra runtime code into HTML, we have disabled this ability by default. If you need to enable it, you can configure it in the form of an object, for example:
When you enable this ability, the default config of assetsRetry is as follows:
You can also customize your retry logic using the assetsRetry options.
For example, setting assetsRetry.domain to specify the retry domain when assets fail to load.
After adding the above configuration, when assets fail to load from the cdn1.com domain, the request domain will automatically fallback to cdn2.com.
If the assets request for cdn2.com also fails, the request will fallback to cdn3.com.
assetsRetry is implemented based on the Assets Retry plugin of Rsbuild and provides the same configuration options. You can refer to Rsbuild - Assets Retry Plugin to understand all available configuration options.