How should Realm functions share JS code?

So I’m scratching together a mildly complex application where I’d like:

  • my Realm functions to share internally written code (snippets in folders in my project structure)
  • my Realm functions to make use of NPM modules

I’ve found this, Javascript folders for sharing code between MongoDb Realm Functions?, which suggests to me that a solution is coming, but I’m wondering how everyone here does it.

I’m trying to avoid having to webpack or otherwise bundle my internal snippets to address my first point and also have to upload a node_modules archive to address my second one.

I’ve tried to inline all my dependencies but haven’t found a way that results in output that Realm is happy with (Realm always seems to find some kind of syntax issue with the generated JS).

Does someone have a webpack.config or other recipe they can share?

FWIW, we’re on Typescript@4 and tried targeting various ES levels down to ES5, but nothing seems to fit.