Skip to content

Commit

Permalink
Tweak comments
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Jan 6, 2025
1 parent 904458d commit e7fa7e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions packages/react-router-dev/vite/cloudflare-dev-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ export const cloudflareDevProxyVitePlugin = <Env, Cf extends CfProperties>(
config: async () => {
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
// This is a compatibility layer for Vite 5. Default conditions were
// automatically added to any custom conditions in Vite 5, but Vite 6
// removed this behavior. Instead, the default conditions are overridden
// by any custom conditions. If we wish to retain the default
// conditions, we need to manually merge them using the provided default
// conditions arrays exported from Vite. In Vite 5, these default
// conditions arrays do not exist.
// https://vite.dev/guide/migration.html#default-value-for-resolve-conditions
const serverConditions: string[] = [
...(vite.defaultServerConditions ?? []),
Expand Down
10 changes: 7 additions & 3 deletions packages/react-router-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,13 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
viteConfigEnv = _viteConfigEnv;
viteCommand = viteConfigEnv.command;

// 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
// This is a compatibility layer for Vite 5. Default conditions were
// automatically added to any custom conditions in Vite 5, but Vite 6
// removed this behavior. Instead, the default conditions are overridden
// by any custom conditions. If we wish to retain the default
// conditions, we need to manually merge them using the provided default
// conditions arrays exported from Vite. In Vite 5, these default
// conditions arrays do not exist.
// https://vite.dev/guide/migration.html#default-value-for-resolve-conditions
let viteClientConditions: string[] = [
...(vite.defaultClientConditions ?? []),
Expand Down

0 comments on commit e7fa7e2

Please sign in to comment.