2.0.1 • Published 2 years ago

chunks-extract-plugin v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

chunks-extract-plugin


extract chunkMap to json file, and read it.

Version

webpackchunks-extract-plugin
5.x2.x
4.x1.x

Before

javascript file

var url = __webpack_require__.p + __webpack_require__.u(chunkId);

After

javascript file

let fetchSrc
new Promise(function(resolve, reject) {
fetch(__webpack_require__.p + 'routes.json')
.then(response => response.json())
.then(response => {
    fetchSrc = __webpack_require__.p + response[chunkId] + ".chunk.js";
    return resolve();
})
.catch(() => resolve());
}).then(function(){
    var url = fetchSrc;
    // code
});

json file

{"0":"0-2b10c240", "1":"0-2b10c240"}

License


MIT Licensed Copyright (c) 2023 Iftek

2.0.1

2 years ago

2.0.0

2 years ago

1.0.0

3 years ago