-
Notifications
You must be signed in to change notification settings - Fork 272
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: provide both browser and node cjs bundles #2457
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2457 +/- ##
=======================================
Coverage 85.54% 85.54%
=======================================
Files 368 368
Lines 7850 7850
Branches 1906 1906
=======================================
Hits 6715 6715
Misses 1044 1044
Partials 91 91 ☔ View full report in Codecov by Sentry. |
// As the community transitions to ESM, we can easily break our CJS bundle. | ||
// This smoke test can help to detect this early. | ||
|
||
require('../dist/index.node.cjs'); |
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.
🍓 The node bundle should be usable without DOM.
Size Change: +386 kB (+59.35%) 🆘 Total Size: 1.04 MB
ℹ️ View Unchanged
|
## [12.0.0-rc.8](v12.0.0-rc.7...v12.0.0-rc.8) (2024-08-15) ### Bug Fixes * **deps:** drop remark-gfm version ([#2471](#2471)) ([1b359f7](1b359f7)) * do not rerender on client options update ([#2465](#2465)) ([81f33ba](81f33ba)) * do not rerender on client options update ([#2465](#2465)) ([3899352](3899352)) * downgrade react-markdown to v8 that supports React version < v18 ([#2461](#2461)) ([5e6fea0](5e6fea0)) * forward StreamChat constructor options via useCreateChatClient ([#2463](#2463)) ([310835d](310835d)) * prevent ChannelPreviews with duplicate keys ([1a075ad](1a075ad)) * prevent including own user in read count displayed in MessageStatus ([#2459](#2459)) ([061d1a3](061d1a3)) * provide both browser and node cjs bundles ([#2457](#2457)) ([273ea2a](273ea2a)) ### Chores * **deps:** remove unused isomorphic-ws from dependencies ([853bd8b](853bd8b))
🎉 This PR is included in version 12.0.0-rc.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎯 Goal
Although it rarely makes sense to SSR chat, import
stream-chat-react
on server ideally shouldn't fail.🛠 Implementation details
We now build two CJS bundles: one with node-specific dependencies (esbuild
platform: 'node'
), one with browser-specific dependencies (esbuildplatform: 'browser'
). The node version is exposed as a"node"
export in package.json, so frameworks like Next.js should prefer it for SSR.