mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-27 05:28:43 +02:00
fix(v2): dont block nodejs loop with await randomly (#1541)
* fix(v2): dont block nodejs loop with await randomly * lint
This commit is contained in:
parent
594ede3bdc
commit
7ca66cb79e
1 changed files with 11 additions and 4 deletions
|
@ -42,7 +42,7 @@ export async function load(
|
||||||
);
|
);
|
||||||
|
|
||||||
const siteConfig: DocusaurusConfig = loadConfig(siteDir);
|
const siteConfig: DocusaurusConfig = loadConfig(siteDir);
|
||||||
await generate(
|
const genSiteConfig = generate(
|
||||||
generatedFilesDir,
|
generatedFilesDir,
|
||||||
CONFIG_FILE_NAME,
|
CONFIG_FILE_NAME,
|
||||||
`export default ${JSON.stringify(siteConfig, null, 2)};`,
|
`export default ${JSON.stringify(siteConfig, null, 2)};`,
|
||||||
|
@ -99,7 +99,7 @@ export async function load(
|
||||||
routesPaths,
|
routesPaths,
|
||||||
} = await loadRoutes(pluginsRouteConfigs);
|
} = await loadRoutes(pluginsRouteConfigs);
|
||||||
|
|
||||||
await generate(
|
const genRegistry = generate(
|
||||||
generatedFilesDir,
|
generatedFilesDir,
|
||||||
'registry.js',
|
'registry.js',
|
||||||
`export default {
|
`export default {
|
||||||
|
@ -114,13 +114,20 @@ ${Object.keys(registry)
|
||||||
.join('\n')}};\n`,
|
.join('\n')}};\n`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await generate(
|
const genRoutesChunkNames = generate(
|
||||||
generatedFilesDir,
|
generatedFilesDir,
|
||||||
'routesChunkNames.json',
|
'routesChunkNames.json',
|
||||||
JSON.stringify(routesChunkNames, null, 2),
|
JSON.stringify(routesChunkNames, null, 2),
|
||||||
);
|
);
|
||||||
|
|
||||||
await generate(generatedFilesDir, 'routes.js', routesConfig);
|
const genRoutes = generate(generatedFilesDir, 'routes.js', routesConfig);
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
genSiteConfig,
|
||||||
|
genRegistry,
|
||||||
|
genRoutesChunkNames,
|
||||||
|
genRoutes,
|
||||||
|
]);
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
siteConfig,
|
siteConfig,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue