Parcel v2
parceljs.org
parceljs.org
Hopefully this situation improves as more competitors (like Parcel and Esbuild) mature, but at the moment I'd be pretty hesitant to build on anything that's not webpack or webpack based unless you're a lot more confident figuring out build tool setup from first principles than I am.
* V2, about a year ago, since my options were between the non-production-ready v2 and the explicitly unsupported v1.
Parcel’s implicit plugin loading with node-gyp and randomly-dowloading-from-the-internet binaries system (rightfully) does not play well with Nix.
Considering I’m not even leveraging code splitting or many of Webpack’s advanced features, I’m now investigating the cost of switching to something built on esbuild to lessen my Webpack burden and get much better build performance. Honestly makes me miss Tup and Make as front-end tooling exploded with complexity.
That said, I very much preferred Parcel to Webpack as the JSON5 config was declarative and simpler and the HTML entry point.
Parcel in my experience still came with less issues than Webpack to be clear (and talking about the woes from Webpack was the main reason I commented). Now esbuild is on the front page and we can see some users saying it was a smart switch away from Webpack (https://news.ycombinator.com/item?id=28861732)
If you're certain it covers all of your requirements out of the box, it's a great option. Otherwise...you're probably better off configuring Webpack from the start. I've never hit an issue with Webpack that can't be solved (an likely it has already been solved by someone else).
Everything old is new again! Parcel embarks on the path that Webpack did, and it's only a matter of time before the plugins are doing more and more core work, and Parcel's successor will again rewrite them and bring those in to the core.
> The eternal cycle of developer tool bullshit:
> 1. "Ugh, OldTool™ v3.0.0 is overcomplicated, bloated, slow and unnecessarily configurable!"
> 2. "Introducing SuperTool™ v1.0.0, which just does the stuff you really need. No bloated configuration. No huge ecosystem of extensions. Simple, straightforward and fast."
> 3. "SuperTool™ v1.0.0 is great! But our setup really needs it to do something a bit different, so we've hacked in this extension."
> ...repeat for a while...
> 10. "Introducing SuperTool™ v2.0.0, which now has a more flexible API and configuration , allowing many former hacks to be done in a straightforward way."
> …
I still don't think that Parcel is right for me given how comfortable I am with Webpack, but I welcome a "simpler config" option. Provide language support, but don't assume I want to use Babel, or PostCSS, or any other build tool.
I'm an optimist, though admittedly entirely ignorant of this project. I think some capacity is sometimes lost when new projects are started with new technologies that don't live up to their predecessors, but that accusations of tool choice being fashion-driven are mostly misplaced. There are real, tangible, frequent improvements, and disruption is probably the price of innovation. And it's a price you can mostly avoid paying if you want to keep using what you're using.
My understanding is that webpack can do all of this, you just need a few weeks and a PhD in webpack.
Uff, really hits the nail on the head from my experience with setting projects in the early webpack days.
And Webpack embarked on the path that it’s forefathers did.. gulp, babel, browserify, grunt, and others. But that didn’t stop Webpack from improving on what was there.
The core thing Parcel does (or at least did when Parcel was started) that is/was a fundamental improvement over Webpack is parse your index.html (or whatever you name it, of course) to figure out what to do. I always thought Webpack was silly for asking a human to re-describe it’s html dependencies. I haven’t used Webpack in the last year, so I’m unaware if Webpack has fixed this shortcoming.
Parcel 2 Beta 3 – improved build performance - https://news.ycombinator.com/item?id=27222460 - May 2021 (69 comments)
Also related:
Parcel – Fast, zero-configuration web application bundler - https://news.ycombinator.com/item?id=21961963 - Jan 2020 (201 comments)
Parcel: Fast, zero configuration web application bundler - https://news.ycombinator.com/item?id=17547433 - July 2018 (91 comments)
Parcel – A fast, zero configuration web application bundler - https://news.ycombinator.com/item?id=15853149 - Dec 2017 (163 comments)
Esbuild – An extremely fast JavaScript bundler
In the ideal world, you would use esbuild only, but you still need the other features for development: hot reload, hot module repalcement, and pretty error pages when you cause a RuntimeError.
Edit: I found this on Vite's website: "Vite plugins extends Rollup's well-designed plugin interface with a few extra Vite-specific options. As a result, you can write a Vite plugin once and have it work for both dev and build." https://vitejs.dev/guide/api-plugin.html
You actually don't need hot reload or hot module replacement. esbuild is so fast you can just reload the page and it reloads instantly.
hot reload is really bad with slow bundlers. One of the projects I have to maintain at work has this hot reload feature. Here's how it goes: I edit a sass file, it recompiles in the background for 5 seconds, then reloads 4 or 5 times. Why? Who knows.
You don’t actually need any of these tools. But HMR is useful not because build time is slow (even if it often is), but because dev/validation iteration is slow too. TDD can improve some of that, but when you’re iterating on something interactive and want to validate the experience of it (or any number of other circumstances where manual validation provides value), having your setup state preserved can mean the difference between split second validation (with fast tooling) and completely breaking flow.
When you make the change you want to see what that change does to your form in its current state.
That's why things like mock-service-worker or having prefilled Redux stores (or whatever state management you use that allows something similar) are a real time saver.
Of course fixing the bug based on test is always better, but often you have to fix something visual which is a little bit harder to do with tests.
The summary is that you should use esbuild (or swc/spack when ready) for new projects and probably switch existing ones as well if feasible.
It's possible that the Parcel 2 version they used is not the released one, so maybe it improved.
I'd guess so because of timing and because the Parcel 2 beta 3 announcement [1] says "10x faster JavaScript compiler written in Rust [...] on top of the SWC compiler". Likely the esbuild folks benchmarked against beta 2 or earlier.
However, it needs source (user code and npm packages) to be in ESM modules, so it uses esbuild for pre bundling npm packages.
And vite uses roll-up to create a production build with some parts done by esbuild
I was really impressed with the speed of Vite, which uses Rollup under the hood. I never had any real complains about Webpack's speed until I tried Vite out. In my experience with Vue apps, the difference between Vite (Rollup) and Webpack was much greater than esbuild's data shows.
Very unclear what it does, until I tried to copy/paste the title. That changing word should just be a list.
The selling point for parcel is that it does the above with zero configuration (you point it at your input directory and it automatically figures out which compilers / optimisers to use -- other builders typically require hours of googling for / installing / configuring / debugging plugins)
We tried switching to Parcel v2 but we had to downgrade back to v1.
Having said if this turns out to be a low hassle tool to build library then I might use it. My pain point is the boilerplates involved in building libraries. For apps, I'm pretty happy with nextjs default.
The JavaScript ecosystem is so dang confusing. I'm glad I'm not a frontend dev who has to deal with that hot mess.
You set it up, and write your js code, and parcel spits out the final, ready to embed in your html file, js and css assets.
That's oversimplified, but the basics all the same.
I recently upgraded Webpack from 4 to 5 and briefly looked for alternatives, but ultimately just decided to stick with Webpack since it works for us.
If you don't care about having a large plug-in ecosystem, or things like image optimization being handled directly by your bundler (and other stuff, from scanning the linked article), I'd say just go with esbuild
It's so much nicer to use than all the other bundlers.
EDIT:
To clarify, the dev experience is:
- You start with just the basic bundler with simple options you specify on the command line or maybe in a shell script.
- Then you want to do a few more things, so you turn the shell script into a nodejs script (or a Go program).
- You get to make the build script as simple or complex as you want. To your own discretion and to fit your use case.