Re:Today’s JavaScript, from an outsider’s perspective (2020)
by SahAssar on Friday May 27, 2022 @12:14PM
(#31531305)
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.
Re:Today’s JavaScript, from an outsider’s perspective (2020)
by corrral on Friday May 27, 2022 @12:55PM
(#31531844)
Thank 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.
Re:Today’s JavaScript, from an outsider’s perspective (2020)
by SahAssar on Friday May 27, 2022 @01:47PM
(#31532501)
I 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.
I've written JS professionally for probably 12 or 13 out of the last 22 years, but I skipped the first couple iterations of frontend bundlers and tooling (kept rocking it old-school and just including plain .js files with script tags) until React, so I seem to have missed that intermediate phase, and now I cannot find it. I've lost probably 3 to 4 hours to trying to figure this out, last couple times I looked.