mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-05 02:47:50 +02:00
fix(v2): filter out invalid prefetch script without contenthash (#2167)
This commit is contained in:
parent
75f5bb4d23
commit
6f6f756d70
1 changed files with 4 additions and 1 deletions
|
@ -58,7 +58,10 @@ const docusaurus = {
|
||||||
// Pass it the chunkName or chunkId you want to load and it will return the URL for that chunk
|
// Pass it the chunkName or chunkId you want to load and it will return the URL for that chunk
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const chunkAsset = __webpack_require__.gca(chunkName);
|
const chunkAsset = __webpack_require__.gca(chunkName);
|
||||||
if (chunkAsset) {
|
|
||||||
|
// In some cases, webpack might decide to optimize further & hence the chunk asssets are merged to another chunk/previous chunk
|
||||||
|
// Hence, we can safely filter it out/ dont need to load it
|
||||||
|
if (chunkAsset && !/undefined/.test(chunkAsset)) {
|
||||||
prefetchHelper(chunkAsset);
|
prefetchHelper(chunkAsset);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue