nats.deno icon indicating copy to clipboard operation
nats.deno copied to clipboard

Improved Codesplitting for smaller bundles

Open enex opened this issue 1 year ago • 1 comments

I want to use the library in a webapp in the browser. However the bundle size is rather large even thought i do not use jetstream and several of the other APIs. To avoid having to load it an alternative connect could be introduced that does the bare minimum and has the bare minimum of methods. If you then want to use for example jetstream, the api consumer imports it directly and passes it the connection. This is similar to how firebase restructured there API and would allow efficient code splitting and thus more resource efficient usage in the browser. It might also be beneficial to edge functions because the bundle size of the resulting JS can be reduced in many cases.

enex avatar Jun 19 '23 12:06 enex