Repository navigation
chore(web): silence benign config-load dep warnings in npm run dev - #1408
Conversation
`vite dev` printed three UNRESOLVED_IMPORT warnings at startup (chokidar, atomically, @napi-rs/keyring). They originate from Vite's config bundler (Rolldown): the Hono plugin statically imports the node-only dev backend (core/mcp/remote/node/server.ts), so loading vite.config.ts bundles it and Rolldown walks its node-only deps. Those deps are correctly externalized — the browser never loads them and Node resolves them at runtime — so the warnings are pure noise. They can't be filtered the usual ways: the static import is required (the monorepo has no node_modules under core/, so the aliases must resolve the deps at bundle time — ssrLoadModule / `--configLoader runner` both fail to resolve them), and the warnings are written directly to the process streams during config load, bypassing customLogger, logLevel, and rollupOptions.onwarn. Fix: a tiny `--import` hook (server/quiet-config-warnings.mjs) that drops only those specific benign warning writes, wired into the `dev` script. Scoped to `npm run dev` — build, tests, and prod are untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 1m 33s —— View job Claude PR Review
SummaryTight, well-scoped fix for a real annoyance. The unusual approach (monkey-patching Strengths
Suggestions (optional, not blocking)
Non-issues I considered
VerdictLGTM. Ship as-is, or take suggestion (1) if you want a little extra safety margin. The AGENTS.md update at |
- Tighten BENIGN_PAIRS to repo-relative path fragments (not basenames) so an unrelated future UNRESOLVED_IMPORT warning mentioning the same dep + a same-named file isn't silently dropped. Verified Rolldown prints the full repo-relative path. (review #1) - Add a note that the matcher tracks Rolldown's message format and degrades to a safe no-op (warnings return) if that format changes. (review #2) - Export isBenignWarning/BENIGN_PAIRS, guard the stream patching behind !VITEST, add a .d.mts so the pure helper is importable from TS, and add a unit test locking the signature pairs and the over-match guards. (review #3) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the review! Took all three suggestions in daecf59:
Re-verified |
Problem
npm run dev(vite) printed threeUNRESOLVED_IMPORTwarnings at startup, before the server banner:Why they happen
The Hono dev plugin statically imports the node-only backend (
core/mcp/remote/node/server.ts). Loadingvite.config.tstherefore pulls that file into Vite's config bundler (Rolldown), which walks its node-only deps and warns that it's externalizing them. They're benign — the browser never loads these deps, and Node resolves them at runtime.Why the usual fixes don't work
ssrLoadModuleor--configLoader runner:core/has nonode_modules, so the aliases must resolve these deps at bundle time. Both alternatives fail withCannot find module 'atomically'/require is not defined.customLogger,--logLevel silent, andbuild.rollupOptions.onwarnall miss them (verified).Fix
A small
--importhook (server/quiet-config-warnings.mjs) that drops only those specific benign warning writes (matched byUNRESOLVED_IMPORT+ the exact package/source-file pair), wired into thedevscript:Scoped to
npm run devonly —build, tests, Storybook, and prod are untouched. All other dev output (errors, HMR, real warnings) passes through unchanged.Verification
npm run devstartup is now clean (0 of the 3 warnings, no code-frame remnants, banner/sandbox URL intact).npm run validategreen.🤖 Generated with Claude Code