Deploying Remix w/Vite (dev v. prod)

I'm trying to figure out when I'll know if my project will deploy to Pages w/o error in production. Here's the situation: I'm working on a Remix 2.15.2 project that is slated to be deployed to Pages. I'm looking at upgrading it to Vite from what Remix calls the "classic compiler." If I do this, the Remix Discord tells me that my project won't be running Wrangler when in dev due to its use of Vite (env API-related, I think). This means the project can break when deploying to prod should I inadvertently use a node library. My questions: 1. Will preview deployments use Wrangler, thus telling me if something is wrong with a prod deploy? 2. Will the main branch — accessible by default at *.pages.dev — use Wrangler, thus telling me if something is wrong with a prod deploy? Does this make sense? Really appreciate any clarity you can provide.
1 Reply
i40west
i40west4w ago
You can actually run it either way. The normal dev server will use vite. My experience is that it is not reliable and doesn't work very well, but it's fast and it hot-reloads. You can also run wrangler pages dev directly on it, you just have to build the project first and there won't be any hot reloading. What I do is I have a dev script in my package.json that runs remix vite:dev. Then I have a preview one that runs wrangler pages dev ./build/client. I always use preview before deciding I'm done with anything.

Did you find this page helpful?