Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

rspack-retry-chunk-load-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rspack-retry-chunk-load-plugin

A rspack plugin to retry loading of chunks that failed to load

beta
latest
Source
npmnpm
Version
0.0.1-beta.0
Version published
Maintainers
1
Created
Source

webpack-retry-chunk-load-plugin

Build Status codecov npm version GitHub issues GitHub stars GitHub license

A webpack plugin to retry loading of async chunks that failed to load

screenshot 2018-10-24 at 21 47 39

Usage

// webpack.config.js
const { RetryChunkLoadPlugin } = require('webpack-retry-chunk-load-plugin');

plugins: [
  new RetryChunkLoadPlugin({
    // optional stringified function to get the cache busting query string appended to the script src
    // if not set will default to appending the string `?cache-bust=true`
    cacheBust: `function() {
      return Date.now();
    }`,
    // optional value to set the amount of time in milliseconds before trying to load the chunk again. Default is 0
    // if string, value must be code to generate a delay value. Receives retryCount as argument 
    // e.g. `function(retryAttempt) { return retryAttempt * 1000 }`
    retryDelay: 3000,
    // optional value to set the maximum number of retries to load the chunk. Default is 1
    maxRetries: 5,
    // optional list of chunks to which retry script should be injected
    // if not set will add retry script to all chunks that have webpack script loading
    chunks: ['chunkName'],
    // 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';",
  }),
];

Webpack compatibility

Webpack versionwebpack-retry-chunk-load-plugin version
5.x2.x
4.x1.x

angular cli

To use this with the angular CLI you can use the fantastic angular-builders project to extend the built in webpack config

License

MIT

Keywords

webpack

FAQs

Package last updated on 12 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts