-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: 兼容一下部分库的浏览器入口配置 #12421
base: master
Are you sure you want to change the base?
fix: 兼容一下部分库的浏览器入口配置 #12421
Conversation
具体表现为qrcode这种node环境和浏览器环境不同代码的,且在package.json中配置了browser的库。升级项目采用mfsu时遇到打包依赖报错,入口选择node版本的
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Walkthrough此次修改主要是增强了对某些库(如 Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/mfsu/src/utils/resolveUtils.ts (1)
Line range hint
52-52
: 请避免使用any
类型,这可能会导致类型安全问题。建议指定一个更精确的错误类型,例如Error
。- let lastError: any = null; + let lastError: Error | null = null;
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/mfsu/src/utils/resolveUtils.ts (1 hunks)
Additional Context Used
Biome (1)
packages/mfsu/src/utils/resolveUtils.ts (1)
52-52: Unexpected any. Specify a different type.
Additional comments not posted (1)
packages/mfsu/src/utils/resolveUtils.ts (1)
16-16
: 添加aliasFields: ["browser"]
是为了解决特定库(如 qrcode)在其package.json
中指定浏览器入口的兼容性问题。建议在此行上方添加更详细的注释,说明此配置的具体作用和影响。
感觉不是 resolve 配置的问题,我新创建一个 umi 项目,安装 qrcode ,然后按照官方 readme 里的 demo 使用是正常运行的。 |
关于resolveUtils.test.ts里的测试用例我看过了,没有 |
具体表现为qrcode这种node环境和浏览器环境不同代码的,且在package.json中配置了browser的库。升级项目采用mfsu时遇到打包依赖报错,入口选择node版本的。也希望官方给出更好的方案,遇到问题的库时 [email protected]
Summary by CodeRabbit
qrcode
)的兼容性,这些库在其package.json
中配置了browser
入口点。