Repository navigation
fix(mdx-loader): keep the cross-compiler cache working when loader options are deep-cloned (AI-assisted) - #12733
Merged
Merged
Conversation
…tions are deep-cloned (AI-assisted) Rsdoctor v1 deep-clones the loader options of each module, turning the cross-compiler cache Map into a plain object. Building a webpack site with Rsdoctor crashed with "crossCompilerCache?.get is not a function". Pass a getter function instead of the Map: functions are not cloned, so the client and server compilations keep sharing the same cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Building a webpack site (
webpack: true) with@docusaurus/plugin-rsdoctor(Rsdoctor v1) crashes in the MDX loader:For each module, Rsdoctor v1's loader interceptor deep-clones
module.loaderswith its ownsafeCloneDeep(). That function turns the cross-compiler cacheMapwe pass in the loader options into a plain object{}, so the cache shared by the client and server compilations is lost. Functions are returned as is.The crash appeared with #12605, which made the cross-compiler cache always on. Rspack + Rsdoctor v2 is not affected.
This PR passes a
getCrossCompilerCache()function in the loader options instead of theMapitself. Since functions are not cloned, both compilations keep sharing the same cache, even when the options are deep-cloned.(AI-assisted)
Test Plan
TypeError.DOCUSAURUS_SLOWER=true pnpm build:website:fast:rsdoctor(webpack + Rsdoctor v1) now builds successfully.pnpm build:website:faststill builds successfully.Test links
Deploy preview: https://deploy-preview-12733--docusaurus-2.netlify.app/
Related issues/PRs
🤖 Generated with Claude Code