perf: exclude node_modules from content globbing in monorepos#12199
Open
srpatcha wants to merge 1 commit into
Open
perf: exclude node_modules from content globbing in monorepos#12199srpatcha wants to merge 1 commit into
srpatcha wants to merge 1 commit into
Conversation
In monorepo setups with hoisted/linked dependencies, Globby scans through node_modules directories when sourcing content, causing extreme startup slowness (34s to 330ms in the reported case). Changes: - Add **/node_modules/** to GlobExcludeDefault in globUtils.ts - Add ignore pattern to readCategoriesMetadata() in sidebars/index.ts which had no ignore patterns at all - Add test coverage for node_modules exclusion Fixes facebook#12128
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
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
Fixes #12128
In monorepo setups with hoisted/linked workspace dependencies (pnpm, yarn workspaces), Globby scans through
ode_modules\ directories when sourcing docs/blog/pages content. This causes extreme startup slowness — the reporter measured 34 seconds reduced to 330ms after adding node_modules to the ignore list.
Changes
\packages/docusaurus-utils/src/globUtils.ts**: Add '/node_modules/**'\ to \GlobExcludeDefault, which is used by the docs, blog, and pages plugins when globbing content files.
\packages/docusaurus-plugin-content-docs/src/sidebars/index.ts**: Add \ignore: ['/node_modules/**']\ to
eadCategoriesMetadata()\ — this Globby call had no ignore patterns at all, meaning it scanned every _category_.{json,yml,yaml}\ inside
ode_modules.
**\packages/docusaurus-utils/src/tests/globUtils.test.ts**: Add test coverage for node_modules exclusion in both \createMatcher\ and \createAbsoluteFilePathMatcher.
Test Plan