rspack-plugin-retry-chunk-load
v1.2.0
Published
A rspack plugin to retry loading of chunks that failed to load
Readme
rspack-plugin-retry-chunk-load
A rspack plugin to retry loading of async chunks that failed to load
Inspired by webpack-retry-load-plugin
Usage
// rspack.config.js
import { RetryChunkLoadPlugin } from "rspack-plugin-retry-chunk-load";
plugins: [
new RetryChunkLoadPlugin({
/**
* Optional identifier for the cache-busting function. Can be 'default' (`?cache-bust=true`) or 'timestamp' (Date.now()).
*/
cacheBust: "timestamp",
/**
* Optional custom query parameter key used when cacheBust is enabled.
* Examples:
* cacheBust: "default", cacheBustKey: "v" -> ?v=true
* cacheBust: "timestamp", cacheBustKey: "ts" -> ?ts=1699999999999
* cacheBust: "default", cacheBustKey: undefined -> ?cache-bust=true
* cacheBust: "timestamp", cacheBustKey: undefined -> ?1699999999999
* If cacheBust is not set, cacheBustKey is ignored.
*/
cacheBustKey: "key",
/**
* Optional code to be executed in the browser context if after all retries chunk is not loaded.
* if not set - nothing will happen and error will be returned to the chunk loader.
*/
lastResortScript: "window.location.href='/500.html'",
/**
* Optional value to set the maximum number of retries to load the chunk.
* Default is 3.
*/
maxRetries: 3,
/**
* Optional value to set the amount of time in milliseconds before trying to load the chunk again.
* Default is 100ms.
*/
retryDelay: 100
})
];License
MIT
