Skip to content

fix(plugin-content-docs): ignore node_modules and dist when globbing category metadata - #12451

Open
bodapatisaikrishna wants to merge 1 commit into
facebook:mainfrom
bodapatisaikrishna:fix/docs-plugin-ignore-node-modules-in-glob
Open

bodapatisaikrishna wants to merge 1 commit into
facebook:mainfrom
bodapatisaikrishna:fix/docs-plugin-ignore-node-modules-in-glob

Conversation

@bodapatisaikrishna

Copy link
Copy Markdown

Motivation

Fixes #12128.

When discovering category metadata files (**/_category_.{json,yml,yaml}), readCategoriesMetadata called Globby with only cwd: contentPath. On monorepo sites with nested node_modules (e.g. symlinked or per-package dependencies) or build output folders like dist/, Globby scanned the entirety of these subdirectories. In reported monorepos, this caused Docusaurus startup times to degrade from sub-second to over 34 seconds.

Solution

Add ignore: ['**/node_modules/**', '**/dist/**'] to the Globby configuration in readCategoriesMetadata.

Test Plan

  • Added an automated test in packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/index.test.ts verifying category metadata files located inside node_modules and dist directories are properly ignored during sidebar category discovery.
  • Validated clean TypeScript syntax.

…category metadata

Fixes facebook#12128.

When discovering category metadata files (_category_.{json,yml,yaml}),
readCategoriesMetadata was not ignoring node_modules or dist folders. In
monorepos with package-level node_modules symlinks or build output, this
resulted in excessive file scanning and severe startup slowdowns (from ~34s to <1s).

This adds '**/node_modules/**' and '**/dist/**' to the Globby ignore option
and adds a regression test ensuring category files in those directories are skipped.
@meta-cla

meta-cla Bot commented Sep 17, 2026

Copy link
Copy Markdown

Hi @bodapatisaikrishna!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@netlify

netlify Bot commented Sep 17, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit f0bdb30
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6aaba98c2937a00008eba95e
😎 Deploy Preview https://deploy-preview-12451--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@meta-cla

meta-cla Bot commented Sep 17, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Sep 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docusaurus slow on a monorepo site due to globbing node_modules

1 participant