Skip to content

Commit e7fa7e2

Browse files
Tweak comments
1 parent 904458d commit e7fa7e2

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

packages/react-router-dev/vite/cloudflare-dev-proxy.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ export const cloudflareDevProxyVitePlugin = <Env, Cf extends CfProperties>(
4747
config: async () => {
4848
await preloadVite();
4949
const vite = getVite();
50-
// a compatibility layer from Vite v6+ and below because
51-
// Vite v6 overrides the default resolve.conditions, so we have to import them
52-
// and if the export doesn't exist, it means that we're in Vite v5, so an empty array should be used
50+
// This is a compatibility layer for Vite 5. Default conditions were
51+
// automatically added to any custom conditions in Vite 5, but Vite 6
52+
// removed this behavior. Instead, the default conditions are overridden
53+
// by any custom conditions. If we wish to retain the default
54+
// conditions, we need to manually merge them using the provided default
55+
// conditions arrays exported from Vite. In Vite 5, these default
56+
// conditions arrays do not exist.
5357
// https://vite.dev/guide/migration.html#default-value-for-resolve-conditions
5458
const serverConditions: string[] = [
5559
...(vite.defaultServerConditions ?? []),

packages/react-router-dev/vite/plugin.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,13 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
738738
viteConfigEnv = _viteConfigEnv;
739739
viteCommand = viteConfigEnv.command;
740740

741-
// a compatibility layer from Vite v6+ and below because
742-
// Vite v6 overrides the default resolve.conditions, so we have to import them
743-
// and if the export doesn't exist, it means that we're in Vite v5, so an empty array should be used
741+
// This is a compatibility layer for Vite 5. Default conditions were
742+
// automatically added to any custom conditions in Vite 5, but Vite 6
743+
// removed this behavior. Instead, the default conditions are overridden
744+
// by any custom conditions. If we wish to retain the default
745+
// conditions, we need to manually merge them using the provided default
746+
// conditions arrays exported from Vite. In Vite 5, these default
747+
// conditions arrays do not exist.
744748
// https://vite.dev/guide/migration.html#default-value-for-resolve-conditions
745749
let viteClientConditions: string[] = [
746750
...(vite.defaultClientConditions ?? []),

0 commit comments

Comments
 (0)