Fix Bun server static routes from using the wrong path separator on Windows#5285
Fix Bun server static routes from using the wrong path separator on Windows#5285schiller-manuel merged 2 commits intoTanStack:mainfrom
Conversation
WalkthroughReplaces manual string concatenation for file and route paths in examples/react/start-bun/server.ts with node:path utilities, using path.join and POSIX-style normalization. Adds an import for node:path. No changes to exported/public APIs or control flow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
examples/{react,solid}/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit c8f1913
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/nitro-v2-vite-plugin
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-static-server-functions
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
…rator on Windows (TanStack#5285) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
The issue on Windows:
filepathwill resolve to something likedist/client\assets\index-CYVUvHau.js, which is fine (Windows accepts either path separator and Bun will read the file just fine).routewill resolve into/assets\index-CYVUvHau.js, where the windows path separator\won't match how the route will be requested over HTTP (/assets/index-CYVUvHau.js). So any static route with a path separator in it will fail to work.To fix it, this change does 2 things:
routegeneration by normalizing all path separators into the expected POSIX/.path.join()to createfilepath. Not strictly necessary, but more correct (and we're importingnode:pathanyway for the first fix).This should have no effect on any platform that already uses
/as a path separator (though it is a little noisier).Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores