Skip to content

fix(pnpm): add postinstall dedupe to ensure @types/react override takes effect#624

Closed
easonLiangWorldedtech wants to merge 2 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:fix/vscode-webview-lucide-build
Closed

fix(pnpm): add postinstall dedupe to ensure @types/react override takes effect#624
easonLiangWorldedtech wants to merge 2 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:fix/vscode-webview-lucide-build

Conversation

@easonLiangWorldedtech

@easonLiangWorldedtech easonLiangWorldedtech commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #10480 added react@^19.1.0 to apps/cli/package.json. This caused @types/react@19 to be installed alongside webview-ui's react@^18.3.1, leading to TypeScript errors like:

TS2786: 'Plus' cannot be used as a JSX component.
TS2578: Type 'DetailedHTMLProps<HTMLAttributes, div>' requires 'React.JSX.Element' from module 'react' but was resolved to a different version.

Root Cause

The pnpm override @types/react: 18.3.23 exists in the root package.json, but stale peer dependency resolution can cause @types/react@19 to leak into the lockfile or node_modules during certain install scenarios.

Fix

Add a postinstall script that runs pnpm dedupe --check || true to ensure the override always takes effect after installation:

"postinstall": "pnpm dedupe --check || true"

This forces pnpm to re-resolve dependencies and enforce the override, preventing version conflicts between apps/cli (React 19) and webview-ui (React 18).

Verification

  • webview-ui build passes (tsc -b && vite build)
  • ✅ All 124 test files pass (1369 tests) in @roo-code/core
  • ✅ No @types/react@19 present in lockfile or node_modules after install

Related


Summary by CodeRabbit

Release Notes

  • Chores
    • Improved the installation post-step by running dependency deduplication as a non-blocking step. This helps keep the installed dependency tree more consistent while ensuring installs won’t fail if deduplication encounters issues.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0be6ffb0-8445-478d-b25a-aa314856cc6a

📥 Commits

Reviewing files that changed from the base of the PR and between 88d37ce and de1f6da.

📒 Files selected for processing (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

📝 Walkthrough

Walkthrough

The postinstall script in package.json is updated to run pnpm dedupe || true, suppressing any errors during deduplication.

Changes

postinstall dedupe update

Layer / File(s) Summary
postinstall script update
package.json
postinstall script is updated to run `pnpm dedupe

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A bunny hops through package trees,
pnpm dedupe puts deps at ease.
With \|\| true to catch the fall,
Installation runs through it all. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the problem, root cause, fix details, and verification results, but is missing the required GitHub issue link and pre-submission checklist sections from the template. Add 'Closes: #ISSUE_NUMBER' section and complete the pre-submission checklist to meet template requirements.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a postinstall dedupe script to fix @types/react version conflicts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 10: The postinstall script in package.json is using the --check flag with
pnpm dedupe, which performs a read-only dry run without actually modifying the
lockfile or enforcing dependency overrides. Remove the --check flag from the
postinstall command to enable actual deduplication and enforce the
`@types/react`@18.3.23 override during installation, while keeping the || true to
allow the build to proceed if deduplication encounters any issues.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b3f7e06-2ad6-4a1b-80e1-01155f7daef3

📥 Commits

Reviewing files that changed from the base of the PR and between d3ba52d and 8537523.

📒 Files selected for processing (1)
  • package.json

Comment thread package.json Outdated
@easonLiangWorldedtech easonLiangWorldedtech force-pushed the fix/vscode-webview-lucide-build branch from b3a0c3d to 88d37ce Compare June 14, 2026 14:56
@easonLiangWorldedtech easonLiangWorldedtech force-pushed the fix/vscode-webview-lucide-build branch from 88d37ce to de1f6da Compare June 14, 2026 14:59
@easonLiangWorldedtech easonLiangWorldedtech deleted the fix/vscode-webview-lucide-build branch June 14, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants