4 ms·
For me esbuild has worked pretty well. Given a index.js as the entrypoint for your app: npx esbuild index.js --bundle --sourcemap --minify --outfile=out.js -
by SahAssar 4y ago
For me esbuild has worked pretty well. Given a index.js as the entrypoint for your app:
npx esbuild index.js --bundle --sourcemap --minify --outfile=out.js --format=esm
esbuild is also pretty quick and does not have a lot of npm depencencies thanks to being a go binary.
npx should download and run the binary for you and npx is almost always installed with node automatically.
- corrral 4y agoThank you. It was really hard to figure out which tools even could do this so I knew which one I ought to deeply "RTFM" for, which was really frustrating to me because it seemed like the most obvious default behavior for any JS build/bundle tool, which should be what it did if you just typed "some-build-tool build" or "bundle" or whatever, from your project root with nothing but a package.json containing a "main" entry.
- SahAssar 4y agoI agree that this is really not a good experience. I prefer js projects that don't rely on build tools at all for this reason, but most devs, frameworks and libraries don't support such a use-case. When I have to use build-tools I usually go for esbuild.