Optimizing Web Development: A Seamless Blend of Remix and Vite
Remix switched to Vite as its build tool, and that's a big deal. The old Remix compiler worked, but Vite brings a developer experience that's hard to go b...
23 Dec 2023

Remix switched to Vite as its build tool, and that's a big deal. The old Remix compiler worked, but Vite brings a developer experience that's hard to go back from.
Why Vite matters
Vite uses native ES modules during development. Instead of bundling your entire app on every save, it serves modules individually and only transforms what changed. Cold starts are fast. Hot module replacement is nearly instant.
Compare that to webpack-based setups where a save triggers a full rebundle. On large projects, that's seconds of waiting after every change. Vite makes it milliseconds.
Setting it up
The configuration is minimal. Create a vite.config.ts and add Remix as a plugin:
// vite.config.ts
import { unstable_vitePlugin as remix } from "@remix-run/dev"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [remix()],
})
That's it. Vite handles the dev server, HMR, and production builds. The Remix plugin integrates route-based code splitting, server/client builds, and all the Remix-specific conventions.
What you get
- Fast dev server. Start times drop from seconds to milliseconds.
- Instant HMR. Edit a component, see the change immediately. State is preserved.
- Vite's plugin ecosystem. Need PostCSS, Tailwind, MDX, or SVG imports? There's a Vite plugin for it. No custom Remix configuration needed.
- Better production builds. Vite uses Rollup under the hood, which produces well-optimized bundles with tree shaking and code splitting.
The trade-offs
The Vite integration was initially unstable (the unstable_ prefix was literal). Early adopters hit issues with SSR, CSS processing, and compatibility with some Remix features. Most of these have been resolved, but it's worth testing thoroughly if you're migrating an existing Remix app.
Vite also has its own learning curve. If you're used to webpack's configuration model, Vite's approach to config, plugins, and environment handling is different. Not harder -- just different.
My recommendation
For new Remix projects, use Vite. The developer experience improvement alone justifies it. For existing projects, migrate when you have time to test. The migration itself is straightforward, but edge cases in CSS handling or SSR behavior may need attention.