feat(core): Docusaurus Faster - Rspack Persistent Cache (#10931)

This commit is contained in:
Sébastien Lorber 2025-02-21 11:39:48 +01:00 committed by GitHub
parent 5b848cb2f0
commit e641568e7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 285 additions and 95 deletions

View file

@ -76,7 +76,14 @@ async function createMdxLoaderDependencyFile({
dataDir: string;
options: PluginOptions;
versionsMetadata: VersionMetadata[];
}) {
}): Promise<string | undefined> {
// TODO this has been temporarily made opt-in until Rspack cache bug is fixed
// See https://github.com/facebook/docusaurus/pull/10931
// See https://github.com/facebook/docusaurus/pull/10934#issuecomment-2672253145
if (!process.env.DOCUSAURUS_ENABLE_MDX_DEPENDENCY_FILE) {
return undefined;
}
const filePath = path.join(dataDir, '__mdx-loader-dependency.json');
// the cache is invalidated whenever this file content changes
const fileContent = {
@ -138,7 +145,7 @@ export default async function pluginContentDocs(
options,
versionsMetadata,
}),
],
].filter((d): d is string => typeof d === 'string'),
useCrossCompilerCache:
siteConfig.future.experimental_faster.mdxCrossCompilerCache,