Skip to content

Commit

Permalink
Update importing Vite in Cloudflare plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed Jan 5, 2025
1 parent e5f3101 commit 00a7624
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-router-dev/vite/cloudflare-dev-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type Plugin } from "vite";
import { type GetPlatformProxyOptions, type PlatformProxy } from "wrangler";

import { fromNodeRequest, toNodeRequest } from "./node-adapter";
import { preloadViteEsm, importViteEsmSync } from "./import-vite-esm-sync";
import { preloadVite, getVite } from "./vite";

let serverBuildId = "virtual:react-router/server-build";

Expand Down Expand Up @@ -45,8 +45,8 @@ export const cloudflareDevProxyVitePlugin = <Env, Cf extends CfProperties>(
return {
name: PLUGIN_NAME,
config: async (userConfig) => {
await preloadViteEsm();
const vite = importViteEsmSync();
await preloadVite();
const vite = getVite();
// a compatibility layer from Vite v6+ and below because
// Vite v6 overrides the default resolve.conditions, so we have to import them
// and if the export doesn't exist, it means that we're in Vite v5, so an empty array should be used
Expand Down

0 comments on commit 00a7624

Please sign in to comment.