Amy Blankenship
2 min readAug 25, 2024

--

Let's be fair. This is kind of like when React conned the community into thinking it was faster and easier to learn than Angular 1--because it wasn't doing the full job.

One of the nice things about doing the full build before you can launch is that it shifts failures left. You know the build failed before you launch the project and navigate to the piece of code you're interested in. Vite punts on this, so you launch the code and then wait, and wait, while that compilation happens. If that compilation fails, oops, you just wasted the time Vite supposedly gave you back by hitting the Family Feud buzzer when the answer wasn't on the board. And then if you have e2e tests, the post-launch compilation step will time your tests out. It also has to be done for every test run because there's no artifact in the dist folder with the files already compiled. So you have to do a full build before running your tests. And the time you thought you saved figuring out the configuration using Vite? Kiss it goodby because it's not trivial figuring how to create an npm/yarn script that can do all the steps to allow HMR to work in this scenario.

Also HMR in Vite can be a little misleading. Sometimes you see a visual change, but not all the code recompiled and you think your change didn't work. So if you think your change didn't work, always refresh or at least inspect the file in dev tools to make sure your latest code is actually running.

And let's get real about the supposed time-savings for a medium-to-large project with Vite. If you already _have_ a medium-to-large project, you're upgrading, and the docs around Vite are, IMO, incomplete and confusing when it comes to upgrading from another build system. There are things you have to set type to "module" for in package.json, and then other things that breaks, and you're left piecing together a _lot_ of different docs together to try to figure out what's actually going on before finally you just throw spaghetti at the wall until something sticks.

And that supposedly simple configuration, like React in its early days, is simpler in part because it does less. The trend in new hotness technology is that when it matures enough to do as much as the last new hotness, surprise, it has a _lot_ of the flaws of the old hotness.

I'm not saying don't try or use Vite. I'm just saying it's not a panacea, and a lot of the claims around its supposed advantages would rate "half true" with Politifact. Expect it to be as much of a slog to adopt if you're already using something else as you think it will be, and don't expect it to be a panacea. That said, I don't regret switching. Parcel 1 was completely out-of-date and was holding us back from things we needed to do moving forward. If you're with a build system that's still supported and moving with the times, the ROI may be a little less clear.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (1)