Problem
webjs's dev server picks up edits to server-side modules (route.ts, *.server.ts, page modules during SSR, WS exports) by re-importing them per request with a ?t=<timestamp> query cache-bust (loadWsModule, handleApi, the dev SSR module load). Node honors a changed import query as a fresh module; Bun's ESM loader ignores the query string and returns the cached module, and Bun exposes no module-eviction API. So on Bun, editing a server-side module is not reflected until a dev-server restart.
Verified on Bun 1.3.14: import(url + '?t=1') then import(url + '?t=2') after editing the file returns the FIRST module's exports on Bun (Node returns the second). Surfaced by the #509 Bun test matrix (the api dev-cache-bust test).
Component / page / layout SOURCE edits hot-reload fine on Bun, because the served .ts/.js is read from disk per request (tsResponse / jsModuleResponse), not imported. Only the server-side module EXECUTION path is affected.
Design / approach
No clean webjs-side fix exists today (query cache-bust is the standard ESM trick and Bun ignores it; a unique-path copy breaks relative imports inside the module). Options to investigate when Bun support lands or a workaround emerges:
- Track Bun's module-registry / HMR APIs (e.g.
import.meta.hot, a programmatic eviction) and wire the dev re-import to it on Bun.
- A Bun-specific loader/plugin that re-evaluates a changed module's source.
Blocked on Bun upstream for now; documented as a known limitation in agent-docs/testing.md.
Acceptance criteria
Problem
webjs's dev server picks up edits to server-side modules (
route.ts,*.server.ts, page modules during SSR,WSexports) by re-importing them per request with a?t=<timestamp>query cache-bust (loadWsModule,handleApi, the dev SSR module load). Node honors a changed import query as a fresh module; Bun's ESM loader ignores the query string and returns the cached module, and Bun exposes no module-eviction API. So on Bun, editing a server-side module is not reflected until a dev-server restart.Verified on Bun 1.3.14:
import(url + '?t=1')thenimport(url + '?t=2')after editing the file returns the FIRST module's exports on Bun (Node returns the second). Surfaced by the #509 Bun test matrix (theapidev-cache-bust test).Component / page / layout SOURCE edits hot-reload fine on Bun, because the served
.ts/.jsis read from disk per request (tsResponse/jsModuleResponse), not imported. Only the server-side module EXECUTION path is affected.Design / approach
No clean webjs-side fix exists today (query cache-bust is the standard ESM trick and Bun ignores it; a unique-path copy breaks relative imports inside the module). Options to investigate when Bun support lands or a workaround emerges:
import.meta.hot, a programmatic eviction) and wire the dev re-import to it on Bun.Blocked on Bun upstream for now; documented as a known limitation in
agent-docs/testing.md.Acceptance criteria
route.ts/*.server.ts/ page module is reflected on the next request without a restart (parity with Node dev).agent-docs/testing.mdis removed once fixed.