Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

fix(ui-components): react in regular dependencies causes duplicate hook errors in consumer apps

未关闭 适合新手
#9,175 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript

调研方向

从 packages/ui-components/package.json 开始,检查其中的 dependencies、peerDependencies 和 devDependencies。按描述移动 React,使用范围为 ^19.0.0 的命名 catalog 条目,并验证已发布的 package 能接受由 consumer 安装的 React 19,而不会创建重复副本。

由索引模型根据 Issue 内容生成。

描述

Description

Currently, react is listed under dependencies in packages/ui-components/package.json.

While it works fine inside the monorepo, it breaks consumer apps that use a different sub-version of React 19. Package managers install a duplicate copy of React , leading to the runtime error:

Invalid hook call. You might have more than one copy of React in the same app.

Proposed Solution

Move react from dependencies to peerDependencies (and duplicate in devDependencies for local workspace builds).

We should use a named pnpm catalog (catalog:peer-react19 with a ^19.0.0 range) so the published package accepts any React 19 version installed by the consumer app.

主要语言
TypeScript
星标
6.9k
派生
6.5k
平均合并
2 天 16 小时
30 天内合并 PR
29

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/nodejs.org 的其他 Issue

查看 nodejs/nodejs.org 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。