-
Notifications
You must be signed in to change notification settings - Fork 448
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
Browser build for client #499
Comments
FWIW it comes to about 86KB minified, using a Rollup build with Node polyfills In the ShareDB examples with Browserify, it comes to about 98KB minified.
|
To be clear, what I'm proposing is that we introduce a new file in the NPM package for ShareDB (that's not tracked in Git), which is a Rollup-based UMD build of |
Managed to get the browser build down to 68KB using Closure compiler. |
It might make sense for this to even be a downstream package from ShareDB. That would satisfy the need as well. |
So I got this working. Thinking to publish this on NPM as https://github.com/curran/sharedb-client-browser Thoughts? |
Got the bundle down to 65kB using a more up to date Node polyfill library. |
Turns out such a small bundle was a pipe dream. Closure compiler renamed fields, which broke ShareDB. After switching to "simple" compilation mode, everything actually works and the bundle is 83.6 kB. |
Closing as this is done, albeit externally to mainline ShareDB. If there is any interest in including the browser build in mainline ShareDB feel free to reopen! |
Reopening as this is not really a solved problem. ShareDB does not provide a build in its NPM distribution that is compatible with widely used tools like Vite, as demonstrated in #598 Ideally ShareDB would provide a build for the client entrypoint that is compatible with Vite and other build systems that do not have built-in support for Node polyfills. ProposalIntroduce a new asset published to NPM that is a pre-built bundle of the client-side only. For consumers of ShareDB, instead of saying
we could say
To produce Thoughts? |
Upgraded https://github.com/vizhub-core/sharedb-client-browser to use Browserify and the latest ShareDB version. |
I'm experimenting with using dependencies from a CDN, and it would be interesting to expose
sharedb/lib/client
in a browser build with a browser global. That way it would be possible to load the ShareDB client from a CDN, rather than include it in the project bundle.Would this be of interest to anyone else?
The text was updated successfully, but these errors were encountered: