Skip to content

chore(monorepo): use pnpm isolated nodeLinker, fix stale linkWorkspacePackages comment (AI-assisted) - #12535

Merged
slorber merged 6 commits into
mainfrom
slorber/fix-link-workspace-packages-comment
Oct 1, 2026
Merged

slorber merged 6 commits into
mainfrom
slorber/fix-link-workspace-packages-comment

Conversation

@slorber

@slorber slorber commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Switch the monorepo from nodeLinker: hoisted to isolated (pnpm's default), resolving the existing TODO.

Hoisting let packages import dependencies they don't declare. isolated matches what pnpm users get, so CI now catches these. It already found two user-facing bugs:

  • plugin-pwa passed a bare 'babel-loader' loader name, resolved from the site dir. It fails on sites installed with pnpm's default linker. Now uses require.resolve().
  • module-type-aliases publishes types referencing react-dom/client without depending on @types/react-dom.

Other fixes needed for isolated:

  • Declare missing deps: @types/react-dom (plugin-pwa, theme-search-algolia), vite (root, used by vitest.config.ts), and website devDeps used by theme components ejected in the swizzle CI test (Knip-ignored).
  • plugin-content-docs: un-export DocFrontMatterSchema. Its inferred type referenced joi, an undeclared dependency (TS2883).
  • Snapshot normalizer: node_modules/.pnpm/<id>/node_modules/<pkg> becomes node_modules/<pkg>.

Also fixes the stale linkWorkspacePackages comment. Internal deps already use workspace:*, but the setting is still needed. Init templates keep real versions ("@docusaurus/core": "4.0.0") so create-docusaurus copies them as-is. Without it, pnpm dedupe --check and the Windows in-workspace e2e fail, since 4.0.0 isn't on npm.

(AI-assisted)

Test Plan

CI, plus locally in a worktree outside the main checkout. A nested worktree resolves the parent checkout's hoisted node_modules and hides missing deps.

  • Frozen install (lockfile unchanged), clean build:packages, pnpm test, pnpm lint:ci
  • Website: production-config full build (all versions, Node 24), typecheck, swizzle eject + build + typecheck
  • Windows e2e flow: in-workspace site install, start, build, typecheck

Expected failure while this PR is open: Build Size Report. The PR build passes. The job then installs the base branch (hoisted) over this PR's isolated node_modules, breaking bin shims. Goes away once both use isolated.

Test links

Deploy preview: https://deploy-preview-12535--docusaurus-2.netlify.app/

Related issues/PRs

🤖 Generated with Claude Code

Internal @docusaurus/* deps already use workspace:*. The setting is still
needed because the create-docusaurus init templates use real versions so
they can be copied as-is; it links them to local packages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@slorber
slorber requested a review from Josh-Cena as a code owner October 1, 2026 14:45
@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Oct 1, 2026
@netlify

netlify Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ [V2]

Name Link
🔨 Latest commit 5e8fbd2
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6abeb5132894100008105f68
😎 Deploy Preview https://deploy-preview-12535--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.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 58 🟢 98 🟢 100 🟢 100 Report
/docs/installation 🟠 56 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 64 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 68 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 65 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 66 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 65 🟢 100 🟢 100 🟠 86 Report

- Switch nodeLinker from hoisted to isolated (pnpm default)
- Shorten the linkWorkspacePackages comment
- Un-export DocFrontMatterSchema: its inferred type referenced joi, which
  plugin-content-docs doesn't depend on directly (TS2883 under isolated)
- Strip node_modules/.pnpm/<id>/node_modules/ from test snapshots

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@slorber slorber changed the title chore(monorepo): fix stale linkWorkspacePackages comment (AI-assisted) chore(monorepo): use pnpm isolated nodeLinker, fix stale linkWorkspacePackages comment (AI-assisted) Oct 1, 2026
slorber and others added 4 commits October 1, 2026 17:15
…isted)

- plugin-pwa, theme-search-algolia: add @types/react-dom devDependency
- root: add vite devDependency (imported by vitest.config.ts)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- plugin-pwa: resolve babel-loader with require.resolve() instead of a
  bare loader name resolved from the site dir
- module-type-aliases: add @types/react-dom dependency (types reference
  react-dom/client)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…isted)

The swizzle CI test ejects theme-classic components into the website.
Without hoisting, their imports must be website dependencies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Oct 1, 2026
@slorber
slorber merged commit 7a2ba6d into main Oct 1, 2026
39 of 43 checks passed
@slorber
slorber deleted the slorber/fix-link-workspace-packages-comment branch October 1, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant