mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
Fixes #23431 When HTML files were compiled into executables and served at different routes, script and style tags used relative paths (e.g., `./chunk.js`), which failed to load correctly from nested routes like `/foo/bar`. The issue occurred because: 1. HTML chunks generated script tags with unique keys 2. These keys were replaced with file paths during bundling 3. The path replacement used relative paths when public_path was empty 4. Relative paths resolve differently depending on the URL path The fix ensures that when compiling executables without a custom public_path, HTML asset references use absolute paths (`/chunk.js` instead of `./chunk.js`). This allows the HTML to be served at any route while correctly loading assets. Changes: - Modified `generateChunksInParallel.zig` to use "/" as public_path for compiled executables when no custom public_path is set - Applied same fix to `writeOutputFilesToDisk.zig` for consistency - Added regression test to verify fix