Skip to content

Commit 2817a0c

Browse files
examples: fix Bun server static routes from using the wrong path separator on Windows (#5285)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 58e8a94 commit 2817a0c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

examples/react/start-bun/server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
* bun run server.ts
6464
*/
6565

66+
import path from 'node:path'
67+
6668
// Configuration
6769
const SERVER_PORT = Number(process.env.PORT ?? 3000)
6870
const CLIENT_DIRECTORY = './dist/client'
@@ -309,8 +311,8 @@ async function initializeStaticRoutes(
309311
try {
310312
const glob = createCompositeGlobPattern()
311313
for await (const relativePath of glob.scan({ cwd: clientDirectory })) {
312-
const filepath = `${clientDirectory}/${relativePath}`
313-
const route = `/${relativePath}`
314+
const filepath = path.join(clientDirectory, relativePath)
315+
const route = `/${relativePath.split(path.sep).join(path.posix.sep)}`
314316

315317
try {
316318
// Get file metadata

0 commit comments

Comments
 (0)