6 ms·
Counterpoint: Babel and Webpack are the problem. I've long dreaded touching the JS ecosystem but recently I published a package on NPM using ESM + esbuild to b
by grose 3y ago
Counterpoint: Babel and Webpack are the problem.
I've long dreaded touching the JS ecosystem but recently I published a package on NPM using ESM + esbuild to bundle it and it was--dare I say--pleasant. Top level await is a killer feature, too. Finally we get a real spec for modules instead of some ad-hoc thing that we twist and turn to get running on browsers.
Recently there is a movement in the JS ecosystem to rally around browser APIs, as you can see in edge computing services like Cloudflare Workers and Deno. Modules are a big part of that and one I am quite grateful for. Soon enough Babel will be thought of like Grunt and Gulp and all of the other JS churn.
Edit: originally I borrowed the "is terrible" language from the article but honestly I feel kind of bad about that. They're both projects worthy of respect, but I don't think they should remain as "the status quo".
- azangru 3y ago> Counterpoint: Babel and Webpack are terrible, actually. - You don't get typescript to the browser without them - You don't get next-generation language features right now without them - You can't co-locate non-javascript assets with javascript modules via imports without them (e.g. import css or images from within the script that is using them) without them - You don't get smart assets management (automatic code splitting, hashing, etc.) without them
- zdragnar 3y agoFor your first two points, OP pointed out they used esbuild for a recent npm package. That said, I much prefer tools other than babel and webpack myself. Parcel, Vite, etc. are much nicer to work with, and faster.
- azangru 3y agoOk, I thought OP was expressing a dissatisfaction with the fact that there are build tools in general, and "webpack and babel" were just an example of such tools. In which case esbuild or vite would be essentially the same, but just faster (and probably less flexible, because flexibility is traded for speed). I didn't realise that OP's complaint was strictly about these two tools.
- grose 3y agoI feel like esbuild covers everything I need. I haven't tried the Rust-based ones but they look promising as well. esbuild can deal with Typescript, embed WASM binaries that are importable, do minification, etc. Yes, it's true that Babel will let you use more bleeding edge features but I'm OK with waiting for those to stabilize. In other words, I don't think bundlers are evil, and bundlers can deal with ES Modules just fine if they want to. I will admit that I have a minority philosophy in that I try to minimize my dependency tree for JS projects as much as possible, so maybe some Webpack features are unnecessary for me.
- _fat_santa 3y agoYou can do all of that with Vite. At this point I see Webpack/Babel as "last generation". You still see them everywhere but there are much better tools out there that get the same thing done but much faster with less configuration.
- WorldMaker 3y agoI consider Vite to be in the same "last generation" family as Webpack/Babel; the "last" of the "last generation", kind of. With everything in ES Modules I often don't see much need for other than the Typescript compiler alone (just need type stripping), and when I do need a tool for spot-bundling a library here or there I find esbuild fine to work directly against without the "swiss army knife" weight of Vite sitting on top of it.
- Timon3 3y agoVite uses esbuild, so it doesn't make much sense to put it in a different generation of tooling.
- WorldMaker 3y agoMy view of it is that the kitchen sink/"swiss army knife" mentality is the "previous generation" of Webpack/Babel that Vite fits, and esbuild is the closest to next generation mentality (something of a return to "do one thing/do it well/limit scope"). Vite is obviously at the generation transition boundary by being built on top of esbuild, but that doesn't make it "next generation" in my mind, that just makes it the "last of the dinosaurs, the smart one that figured out some of the meteor about to strike".
- Timon3 3y agoOkay, I understand. I don't think this way of divvying up generations is useful, but I see how you get there. For me "generations" are a lot more about how they approach things than how much they implement. Esbuild kicked off a new generation of fast tooling, and Vite builds on it and integrates other tooling with a shared and stable API, without falling into the same pitfalls Webpack etc. did.
- afavour 3y ago> You don't get typescript to the browser without them In the most literal sense of course you can: Typescript has its own compiler! But more broadly it is a bummer that you need a build tool to use TypeScript. Fingers crossed the “Type annotations as comments” proposal happens: https://github.com/tc39/proposal-type-annotations https://github.com/tc39/proposal-type-annotations