Uh oh!
There was an error while loading. Please reload this page.
feat: add isServer - #4648
Conversation
View your CI Pipeline Execution ↗ for commit fabb267
☁️ Nx Cloud last updated this comment at |
nick-potts
commented
Jul 14, 2025
Is there a way to override this in the router config? |
schiller-manuel
commented
Jul 14, 2025
@nick-potts no. what would you need this for? |
451a556 to
5140f74Compare📝 WalkthroughWalkthroughAdds a new package Changes
Sequence Diagram(s)sequenceDiagram
participant Component
participant isServerModule as isServer (module)
participant Router
participant Env as Server/Browser
Component->>isServerModule: import isServer
Component->>Router: read router.isServer
Component->>isServerModule: evaluate (isServer ?? router.isServer)
alt resolved true
Component->>Env: run server-branch (SSR render)
else resolved false
Component->>Env: run client-branch (hydrate/mount)
else resolved undefined
Component->>Router: fallback to router.isServer decision
Router->>Env: run appropriate branch
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
5140f74 to
b465d43CompareThere was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/react-router/vite.config.ts`:
- Around line 8-12: The Vite config currently unconditionally sets
resolve.conditions to an empty array when VITEST is unset, which overrides
Vite's defaults; change the resolve block so that the conditions property is
only added when process.env.VITEST is truthy (use ['development'] then) and omit
or leave conditions undefined for non-test builds so Vite's default resolution
is preserved; update the resolve object where "conditions" is set in the vite
config (refer to resolve.conditions and process.env.VITEST) to only supply the
conditions key during test runs.
Uh oh!
There was an error while loading. Please reload this page.
| define: { | ||
| // Replace __TSR_IS_SERVER__ with false for client builds | ||
| // This enables tree-shaking of server-only code branches | ||
| __TSR_IS_SERVER__: 'false', | ||
| }, |
There was a problem hiding this comment.
I don't think I saw this variable anywhere, it is a remainder of a previous attempt?
b465d43 to
2941924Compareeae4e68 to
16d8f81Compare4355b76 to
c6e587aCompare
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.