Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround for unexpected ajv of bun install #804

Closed
wants to merge 1 commit into from

Conversation

PeachScript
Copy link
Member

@PeachScript PeachScript commented Feb 11, 2025

降级 @microsoft/api-extractor7.43.7 以绕过使用 bun install 时,底层依赖拿到错误的 ajv 版本导致 father 报错的问题

该问题和 bun 的依赖提升行为有关系,ajv-draft-04@rushstack/node-core-library@5.0.0 才引入的方式,该方式同时声明 ajv-draft-04 + ajv,其中 ajv-draft-04 使用 peerDependencies 声明了需要的 ajv 版本但 bun 却将它提升到了 node_modules 顶层导致拿到错误版本的 ajv 进而报错,使用 pnpm 则无此问题:
图片
现场链接:https://github.com/react-component/motion/actions/runs/13254919898/job/37000056389?pr=62

为什么降级到 7.43.7 可以解?因为依赖关系是 @microsoft/api-extractor@7.43.7 -> @rushstack/node-core-library@4.3.0,连带降级了 @rushstack/node-core-library 则不会引入 ajv-draft-04

需要注意的是,后续升级 TypeScript 到更高版本时必定会匹配更高版本的 @microsoft/api-extractor,那么该绕过方案将会失效 cc @Jinbao1001

@PeachScript
Copy link
Member Author

由于 bun 此前已有类似 issue 且官方进行过修复,在明确这是一个非预期行为而非争议行为的情况下,father 再进行绕过就不合适了,所以方案调整为在 react-component 的 CI 模板中锁定 bun 的版本,并反馈给 bun 等待修复

关联 CI 模板 PR:react-component/rc-test#170
关联 bun issue:oven-sh/bun#8406 (comment)

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.

1 participant