mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 19:32:35 +02:00
fix(v2): prefetch only existing chunks (#1380)
This commit is contained in:
parent
21793a833d
commit
37897ffc96
1 changed files with 6 additions and 3 deletions
|
@ -35,9 +35,12 @@ const docusaurus = {
|
||||||
// Find all webpack chunk names needed
|
// Find all webpack chunk names needed
|
||||||
const matches = matchRoutes(routes, routePath);
|
const matches = matchRoutes(routes, routePath);
|
||||||
const chunkNamesNeeded = matches.reduce((arr, match) => {
|
const chunkNamesNeeded = matches.reduce((arr, match) => {
|
||||||
const chunkNames = Object.values(
|
const chunk = routesChunkNames[match.route.path];
|
||||||
flat(routesChunkNames[match.route.path]),
|
if (!chunk) {
|
||||||
);
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chunkNames = Object.values(flat(chunk));
|
||||||
return arr.concat(chunkNames);
|
return arr.concat(chunkNames);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue