Commit d6fc1d0
fix: normalize Windows paths in generated snapshot and server entry (#3727)
## Summary
- When building on Windows, `path.relative()` produces backslash
separators (`\`) that get hardcoded into the generated `snapshot.js` and
`server.js` files
- If the bundle is then deployed to a Linux server (e.g. Windows CI →
Linux prod), those paths break at runtime
- Fix: add a `toPosix()` helper that normalizes all paths written into
generated files to use forward slashes, applied in three places:
- `root` path passed to `generateServerEntry()`
- `filePath` in `prepareStaticFile()` (from `path.relative()`)
- All path options inside `generateServerEntry()` (root, serverEntry,
snapshotSpecifier)
Closes #3513
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 6dd2c97 commit d6fc1d0
2 files changed
Lines changed: 76 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
378 | 385 | | |
379 | 386 | | |
380 | 387 | | |
381 | | - | |
| 388 | + | |
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
| |||
550 | 557 | | |
551 | 558 | | |
552 | 559 | | |
553 | | - | |
554 | | - | |
555 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
556 | 565 | | |
557 | 566 | | |
558 | 567 | | |
| |||
564 | 573 | | |
565 | 574 | | |
566 | 575 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
571 | 582 | | |
572 | 583 | | |
573 | | - | |
| 584 | + | |
574 | 585 | | |
575 | 586 | | |
576 | | - | |
| 587 | + | |
577 | 588 | | |
578 | 589 | | |
579 | 590 | | |
580 | 591 | | |
581 | | - | |
582 | | - | |
| 592 | + | |
| 593 | + | |
583 | 594 | | |
584 | 595 | | |
585 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments