Vite, Cloudflare, and environment specific wrangler config without rebuilding

Before Cloudflare released the official Vite plugin, the way to deploy across environments was to use the --env "foo" flag, which would automatically pick up your environment configuration for "foo" and deploy to my-worker-name-foo. With the new plugin, when building with Vite, the wrangler config is flattened and output to the build directory, and is required to deploy to the right environment. The problem I have is, I'm deploying to several environments, and the only difference between each of them is the wrangler config's environment. I now have to rebuild my app for each environment, which is kindda wasteful in CI/CD resources. I looked at the compiled wrangler configs, and its not rocket science: I could write something to build it myself and skip the Vite compilation step for each environment, but I'd have to replicate Cloudflare's build logic correctly, and that's error prone. Is there any way to deploy the old way when using the new Vite plugin? Or a supported way to only compile the wrangler config and nothing else?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?