Skip to content

Conversation

@NiuGuohui
Copy link

@NiuGuohui NiuGuohui commented Jan 21, 2026

这个 PR 做了什么? (简要描述所做更改)
将commonjsHelpers相关代码移动到babelHelper.js产物中,防止出现例如getDefaultExportFromCjs函数被打入taro.js,而helper本身又依赖getDefaultExportFromCjs函数导致的循环引入问题。

本身是在使用vite构建小程序时,使用三方库@antmjs/vantui引发的问题。

与此相关的是此PR(#17891)

@Single-Dancer 审查一下是否会有别的问题。

这个 PR 是什么类型? (至少选择一个)

  • 错误修复 (Bugfix) issue: fix #
  • 新功能 (Feature)
  • 代码重构 (Refactor)
  • TypeScript 类型定义修改 (Types)
  • 文档修改 (Docs)
  • 代码风格更新 (Code style update)
  • 构建优化 (Chore)
  • 其他,请描述 (Other, please describe):

这个 PR 涉及以下平台:

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 钉钉小程序
  • QQ 小程序
  • 飞书小程序
  • 快手小程序
  • 头条小程序

Summary by CodeRabbit

发布说明

  • 优化
    • 改进了应用的构建模块分组策略,优化了包加载顺序和依赖处理。

✏️ Tip: You can customize this high-level summary in your review settings.

将commonjsHelpers相关代码移动到babelHelper.js产物中
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

概览

该PR调整了Vite配置中React分块逻辑的模块分组规则:babel相关分组现在包含commonjsHelpersDeps用于babelHelpers块,而taro相关分组则排除commonjsHelpersDeps,改用taroDeps、reactRelatedDeps和tslibDeps组合,以优化块加载分离和处理循环依赖。

变更

分组 / 文件 变更摘要
Vite配置模块分块调整
packages/taro-vite-runner/src/mini/config.ts
修改getManualChunks逻辑中模块分组规则:babel分组添加commonjsHelpersDeps,taro分组删除commonjsHelpersDeps改用taroDeps/reactRelatedDeps/tslibDeps组合,影响babelHelpers、taro及vendors/common块的模块分配策略

预估审查工作量

🎯 2 (简单) | ⏱️ ~8 分钟

可能相关的PR

建议审查人员

  • Single-Dancer
  • yoyo837

兔兔的贺诗

🐰 分块的逻辑在这里翻新,
Babel和Taro各占一方天地,
循环依赖再也不用愁,
模块优雅地各自分飞~
✨ 小小改动,大大妙用!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确反映了主要变更内容——解决Vite打包中的循环引用问题,这正是此PR的核心目的。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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