import-retry-plugin
v1.0.4
Published
dynamic import script with webpack4 ,when loading chunk error,retry it and break cdn ticks
Downloads
5
Readme
- cdn hijacking occasionally; sometimes request with random params (like "react.js?v=12345) is usefull;
- the plugin is in case of webpack4 and is work only with chunked script
- report error
- use SRI
npm i import-retry-plugin --save
webpack.config.js
const ImportRetryPlugin =require("import-retry-plugin");
module.exports = {
plugins:[new ImportRetryPlugin()]
}
js runtime
// the script must excute before import the chunk file
// src:the script's src
// time:1 (first error)
// time:2 (request src with random params and error again)
window.onChunkError=function(src,time){
}