Reducing bundle size by removing minimongo and DDP from the client

Hello!

TL;DR How can I remove minimongo, ddp-client and socket-stream-client from the client bundle?

I’m building a quite simple application (it’s only a login form to an external service) as part of a broader installation, where I want to use Meteor for all applications.

All the communication is done using ordinary HTTP requests – I just want to make sure, that it works with JavaScript switched off. Thanks to the server-render package and WebApp.connectHandlers this works really well.

I use Meteor to render the login form, which itself is built using Svelte. Svelte components provide a render function, but the rendered code contains only HTML and CSS, no JavaScript. If I return this content in my connect handlers, the JavaScript is missing.

As I want to provide some functionality through JavaScript (where it is enabled), I use the standard method of Meteor to render the page using the server-render package. By setting a global JavaScript variable I can hydrate the information generated on the server (I do all the Mongo lookups on the server).

Everything works quite will, I just want to reduce the client bundle size.

I don’t need DDP, a WebSocket connection or MiniMongo on the client, I’d like to remove these packages from the client bundle. All the JavaScript generated by the Svelte components would be sufficient for my use case.

Is there a way to accomplish this with Meteor?

It would also be interesting to import these packages dynamically, so that the initial client bundle could be really small, and DDP, etc. is initiated, e. g. when the user tries to perform a login.

Thanks for your help and ideas!