Observed
The browser console reports, once per session on the world-map screen:
Uncaught Error: Module "node:async_hooks" has been externalized for browser compatibility. Cannot access "node:async_hooks.AsyncLocalStorage" in client code.
Vite's client dep cache also picks up server-only modules (@opentelemetry/sdk-trace-node, undici, @openfeature/server-sdk) into the browser graph.
Expected
No server-only module is evaluated in the browser or the SharedWorker; the console stays clean.
Repro
bun run stack start and bun run dev:app-web.
- Log in and open
/explore with devtools on.
- The externalized-module error appears in the console (it originates from the idle SharedWorker's module graph, so a Playwright page-console listener does not capture it).
Notes
The chain: the idle SharedWorker's activity client (libs/game/idle-client/src/submission/create-activity-service-client.ts) imports buildRetryInterceptor/makeIsRetryable from @vers/service-utils/orpc; that barrel also re-exports buildTracingInterceptor, whose imports end at libs/service/service-utils/src/trace/trace-storage.ts constructing AsyncLocalStorage at module scope. Browser-safe consumers of the retry interceptor evaluate server-only trace storage as a side effect of the barrel. Introduced with the shared retry interceptor (#811/#813).
The error is non-fatal today, but worth verifying the worker's submission path is genuinely unaffected. Likely fixes: split the browser-safe orpc helpers from the tracing interceptor (separate export path), or make the trace storage lazy so importing the barrel never touches node:async_hooks.
Observed
The browser console reports, once per session on the world-map screen:
Vite's client dep cache also picks up server-only modules (
@opentelemetry/sdk-trace-node,undici,@openfeature/server-sdk) into the browser graph.Expected
No server-only module is evaluated in the browser or the SharedWorker; the console stays clean.
Repro
bun run stack startandbun run dev:app-web./explorewith devtools on.Notes
The chain: the idle SharedWorker's activity client (
libs/game/idle-client/src/submission/create-activity-service-client.ts) importsbuildRetryInterceptor/makeIsRetryablefrom@vers/service-utils/orpc; that barrel also re-exportsbuildTracingInterceptor, whose imports end atlibs/service/service-utils/src/trace/trace-storage.tsconstructingAsyncLocalStorageat module scope. Browser-safe consumers of the retry interceptor evaluate server-only trace storage as a side effect of the barrel. Introduced with the shared retry interceptor (#811/#813).The error is non-fatal today, but worth verifying the worker's submission path is genuinely unaffected. Likely fixes: split the browser-safe orpc helpers from the tracing interceptor (separate export path), or make the trace storage lazy so importing the barrel never touches
node:async_hooks.