Notes From Migrating a Large App to Vite
A colleague asked me last week why our team cares so much about form validation. I gave a rambling answer, so here is the longer, more organized version.
The setup was ordinary: Vite at the edges, Vue doing most of the heavy lifting, and a handful of scripts nobody wanted to own. It worked well until usage roughly doubled over a single quarter.
The problem
Most of the complexity was accidental. Over the years we'd layered three different approaches to form validation on top of each other, and each one made sense at the time.
The first symptom was subtle. Nothing failed outright, but form validation kept drifting in the wrong direction, and every fix seemed to make the next one harder.
Trying something different
Rather than a big-bang rewrite, we migrated one module at a time over about 10 weeks, keeping both paths alive behind a flag.
Here's a trimmed-down version of what we ended up with:
.card-list {
container-type: inline-size;
}
@container (min-width: 36rem) {
.card {
display: grid;
grid-template-columns: 12rem 1fr;
gap: 1.5rem;
}
}
It's tempting to generalize this into a library. Resist that urge until you've needed it in at least three places.
A few things that helped along the way:
- Make the default the safe choice, not just the documented one.
- Keep the old path around until the new one has survived a real incident.
- Agree on what "done" means before the first pull request.
- Write the migration guide before writing the migration.
Where this breaks down
None of this is free. The new approach is a bit more verbose, and newcomers occasionally ask why we don't just use Playwright for everything. That's a fair question with a boring answer: we tried, and it made form validation harder to reason about.
The biggest cost was social, not technical. Changing how people think about form validation takes much longer than changing the code.
Takeaways
I don't think there's a universal answer here, but I hope this gives you a few ideas to try on your own project. If you do, I'd love to hear how it goes.