undefined | true | PreloadOption
undefined
Specifies that the user agent must preemptively fetch and cache the target resource for current navigation according to the potential destination given by the as attribute (and the priority associated with the corresponding destination). Refer to preload.
When setting performance.preload
to true
, resources will be preloaded according to the following configuration:
When the value of performance.preload
is object
type, the Rsbuild will enable the preload capability for the specified resource according to the current configuration.
The type
field controls which resources will be pre-fetched, and supports secondary filtering of specified resources through include
and exclude
.
Currently supported resource types are as follows:
async-chunks
: preload all asynchronous resources (on the current page), including asynchronous js and its associated css, image, font and other resources.initial
: preload all non-async resources (on the current page). It should be noted that if the current script has been added to the html template, no additional pre-fetching will be performed.all-chunks
: preload all resources (on the current page), including all asynchronous and non-asynchronous resources.all-assets
: preload all resources, and resources of other pages will be included in the MPA scenario.When you want to preload all image resources in png format on the current page, you can configure it as follows: