Compare commits

...
Author SHA1 Message Date
enricobuehler 1009e14a44 build(web): silence rollup's "use client" directive warnings in the nitro pass
ci / bun-nix (pull_request) Successful in 31s
ci / docs-site (pull_request) Successful in 1m17s
ci / web (pull_request) Successful in 1m19s
ci / rust-arm64 (pull_request) Successful in 2m52s
ci / rust (pull_request) Successful in 7m9s
The nitro server build re-bundles the whole dep tree (`noExternals: true`), so
every React package shipping a `"use client"` banner earns a MODULE_LEVEL_DIRECTIVE
warning — ~150 locally, ~800 in CI — which buries the warnings worth reading.

Ignoring the banner is correct rather than papered over: this bundle is the
Bun/Nitro server, not an RSC module graph, and TanStack Start splits client from
server with its own transform, so nothing downstream consults it.

Supplying `onwarn` replaces nitro's own handler, so its three filters
(CIRCULAR_DEPENDENCY, EVAL, "Unsupported source map comment") are restated.

Verified: `bun run build` drops from 148 such lines to 0 with no other log
delta; `tsc --noEmit` and `biome check` clean.
2026-08-11 21:00:19 +02:00
+23
View File
@@ -211,6 +211,29 @@ export default defineConfig({
compatibilityDate: "2026-06-10",
// Scan server/{middleware,routes} for the auth gate + the /api proxy.
scanDirs: [serverDir],
// Silence rollup's MODULE_LEVEL_DIRECTIVE noise. Because `noExternals` re-bundles the
// whole dep tree into the server output, every React package that ships a `"use client"`
// banner — @tanstack/react-router, radix-ui, framer-motion under @unom/ui — earns one
// "directive was ignored" line, ~800 of them per build, which buries the warnings worth
// reading. Ignoring is the CORRECT outcome here and not a papered-over bug: this bundle is
// the Bun/Nitro server, not an RSC module graph, and Start splits client/server with its
// own transform, so nothing downstream ever consults the banner.
//
// Supplying `onwarn` REPLACES nitro's own (it defu-merges ours over its default), so
// nitro's three filters are restated here — drop this and CIRCULAR_DEPENDENCY comes back.
rollupConfig: {
onwarn(warning, defaultHandler) {
if (
["CIRCULAR_DEPENDENCY", "EVAL", "MODULE_LEVEL_DIRECTIVE"].includes(
warning.code ?? "",
) ||
warning.message.includes("Unsupported source map comment")
) {
return;
}
defaultHandler(warning);
},
},
}),
// Must come AFTER tanstackStart — provides the React JSX transform + Refresh runtime
// that Start's dev mode requires (omitting it leaves the client JS unable to load).