Best practice to deal with npm dependencies / ffi

I know the situation will change with the next compiler iteration but I’m curios how you deal with NPM dependencies in your build when you target the browser?

Right now I usually just require what I need in my .js foreign files, do just spago build and then use some bundler (I don’t need all the power of webpack so I use a combination of browserify and uglify) to bundle those common-js modules starting with output/Main/index.js into a single .js

Obviously this is somewhat dated I guess (and probably a bit stupid) - how do you deal with this?

If you just need Javascript bundling (i.e. not also bundling of other types like sass) and not the absolutely best minified version possible then I would go for esbuild. It’s extremely fast, simple, no-config and produces quite good bundle sizes (although not the best). Note that esbuild will also be the default bundler in spago for v0.15.0.


Thanks for the hint - yes that seems like a great option (given the spago integration - tbh: I noticed the discussion but somehow was under the assumption that there was no consensus yet)

update: Works fine for a simple test project - thanks again <3