Skip to content

Commit

Permalink
Use a compact way to convert to a mutable array
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed Jan 6, 2025
1 parent d487ae0 commit 80b5f15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/react-router-dev/vite/cloudflare-dev-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export const cloudflareDevProxyVitePlugin = <Env, Cf extends CfProperties>(
// 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
// https://vite.dev/guide/migration.html#default-value-for-resolve-conditions
const serverConditions =
"defaultServerConditions" in vite ? vite.defaultServerConditions : [];
const serverConditions: string[] =
"defaultServerConditions" in vite
? [...vite.defaultServerConditions]
: [];

return {
ssr: {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,11 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
// https://vite.dev/guide/migration.html#default-value-for-resolve-conditions
let viteClientConditions: string[] =
"defaultClientConditions" in vite
? Array.from(vite.defaultClientConditions)
? [...vite.defaultClientConditions]
: [];
let viteServerConditions: string[] =
"defaultServerConditions" in vite
? Array.from(vite.defaultServerConditions)
? [...vite.defaultServerConditions]
: [];

logger = vite.createLogger(viteUserConfig.logLevel, {
Expand Down

0 comments on commit 80b5f15

Please sign in to comment.