mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-20 11:37:52 +02:00
chore(v2): better chunk naming
This commit is contained in:
parent
174ad279a6
commit
6f011d8e7a
1 changed files with 3 additions and 3 deletions
|
@ -72,7 +72,7 @@ async function loadRoutes(pluginsRouteConfigs) {
|
||||||
const componentChunk = genImportChunk(componentPath, 'component');
|
const componentChunk = genImportChunk(componentPath, 'component');
|
||||||
addRoutesChunkNames(routePath, 'component', componentChunk);
|
addRoutesChunkNames(routePath, 'component', componentChunk);
|
||||||
|
|
||||||
function genRouteChunkNames(value) {
|
function genRouteChunkNames(value, prefix) {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
return value.map(genRouteChunkNames);
|
return value.map(genRouteChunkNames);
|
||||||
}
|
}
|
||||||
|
@ -80,14 +80,14 @@ async function loadRoutes(pluginsRouteConfigs) {
|
||||||
if (_.isObject(value) && !value.__import) {
|
if (_.isObject(value) && !value.__import) {
|
||||||
const newValue = {};
|
const newValue = {};
|
||||||
Object.keys(value).forEach(key => {
|
Object.keys(value).forEach(key => {
|
||||||
newValue[key] = genRouteChunkNames(value[key]);
|
newValue[key] = genRouteChunkNames(value[key], key);
|
||||||
});
|
});
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const importChunk = genImportChunk(
|
const importChunk = genImportChunk(
|
||||||
getModulePath(value),
|
getModulePath(value),
|
||||||
'module',
|
prefix,
|
||||||
routePath,
|
routePath,
|
||||||
);
|
);
|
||||||
registry[importChunk.chunkName] = {
|
registry[importChunk.chunkName] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue