webpack-retry-plugin

1.0.0 • Public • Published

webpack-retry-chunk-load-plugin

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

require

"assets-retry":https://github.com/Nikaple/assets-retry

Usage

// webpack.config.js
const { WebpackRetryPlugin } = require('webpack-retry-plugin');
const { resolve } = require('path')
const resolvePath = (relativePath) => resolve(process.cwd(), relativePath)

plugins: [
  new RetryChunkLoadPlugin({
    jsOutPath: resolvePath(`dist/js/assets-retry.js`),
    htmlFile: resolvePath(`dist/index.html`),
    outputPath: '/js/assets-retry.js',
    script: `
    <script>
      window.assetsRetryStatistics = window.assetsRetry({
        domain: [document.domain],
        maxRetryCount: 1,
        onFail: function (currentUrl) {
        if (currentUrl.indexOf('css') < 0) return
        window.location.reload()
      }
    })
    </script>`
  })
];

Webpack compatibility

| Webpack version | webpack-retry-plugin version | | 4.x | 1.x |

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i webpack-retry-plugin

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.23 kB

Total Files

9

Last publish

Collaborators

  • lyxverycool