#TL;DR
Remix v2.7.0 now has stable support for Vite, with a faster and more reliable development experience, and we’re excited to announce that this is now fully supported on Netlify. Our new Vite-based Remix adapters and templates are available today for both Netlify Functions and Edge Functions.
#Why Vite?
Vite is the leading build and development tool for web frameworks, and is well loved for its excellent developer experience, speedy performance, and the huge ecosystem of plugins. There’s a reason that almost all modern web frameworks now use it.
In October 2023, the Remix team announced that they were joining this growing community, previewing unstable support in Remix v2.2.0. After several months of furious development, the team has released stable support for Vite in Remix v2.7.0. It is now the recommended way to build all Remix sites.
A note on legacy support
The legacy bundler is still supported, but is likely to be removed in Remix 3.
Netlify will continue to support sites using the legacy bundler, but the Netlify templates will now generate Vite sites.
#Come on in, the water’s lovely!
For all these reasons and more, it’s a great time to start moving your site to use Vite. Here’s how to get started.
To create a new Remix Vite site on Netlify, you just need to run one command:
You can then choose whether you would like to deploy to Netlify Functions (Node-based, deployed to one region) or Netlify Edge Functions (Deno-based, deployed to a global edge network). Your site is then ready to deploy to Netlify.
#Migrating an existing Remix site to Vite
If you have an existing Remix site on Netlify, there are a few steps needed if you want to migrate. The project structure for Netlify Functions and Netlify Edge Functions are now almost identical, but the steps to upgrade are slightly different.
#Netlify Functions
- First, follow the migration steps in the Remix docs , including updating versions and installing Vite.
- Upgrade
@netlify/remix-adapter
- Replace your
remix.config.js
with thisvite.config.ts
:
- Delete
server.ts
andapp/entry.server.tsx
from your site - Change your
package.json
scripts to match these:
- Change your
netlify.toml
to match this:
#Netlify Edge Functions
- First, follow the migration steps in the Remix docs , including updating versions and installing Vite.
- Upgrade
@netlify/remix-edge-adapter
and@netlify/remix-runtime
- Replace your
remix.config.js
with thisvite.config.ts
:
- Delete
server.ts
from your site - Replace your
app/server.entry.tsx
with this:
- Change your
package.json
scripts to match these:
- Change your
netlify.toml
to match this:
Happy Remixing!
#More resources
For more information on building with the technologies in this article:
- Remix on Netlify - in the Netlify docs
- Vite - in the Remix docs
- Remix Vite is Now Stable - in the Remix blog