-
-
Notifications
You must be signed in to change notification settings - Fork 600
fix: ws package causes React-Native build failure
#2857
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
base: alpha
Are you sure you want to change the base?
Conversation
|
I will reformat the title to use the proper commit message syntax. |
|
🚀 Thanks for opening this pull request! |
📝 WalkthroughWalkthroughThe change converts static imports of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)src/WebSocketController.ts (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (1)
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. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
ws package causes React-Native build failure
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #2857 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 6222 6222
Branches 1473 1489 +16
=========================================
Hits 6222 6222 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull request overview
This pull request fixes a React-Native build failure caused by the ws package being included in the bundle despite not being used in that build target. The fix converts static imports to dynamic requires that are evaluated at runtime based on the PARSE_BUILD environment variable.
Changes:
- Converted static ES6 imports (
import ws from 'ws'andimport SocketWeapp from './Socket.weapp') to dynamic CommonJS requires within conditional blocks - This prevents bundlers from including unused WebSocket implementations in platform-specific builds
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pull Request
Issue
Since we don't have tree shaking the ws module gets included in the react-native build when it's not used
Closes: #2633
Before:

After:

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