The `UNRESOLVED_IMPORT` warnings that `quiet-config-warnings.mjs` suppressed no longer occur, so the filter (and the build-time `onwarn` suppressions for the same three deps) are removed. Root cause: Vite's config bundler (Rolldown) statically walks the node-only dev backend (`core/mcp/remote/node/server.ts`) when it loads `vite.config.ts`, reaching `chokidar`, `atomically`, and `@napi-rs/keyring`. `core/` has no node_modules of its own, so at config-bundle time those deps resolve from `core/`'s parent chain — the repo-root `node_modules`. Before #1452 the deps lived only under `clients/web/node_modules` (a sibling, off the resolution chain), so Rolldown emitted `UNRESOLVED_IMPORT`. #1452 declared them in the repo-root `package.json` (for the CLI/TUI/launcher, which consume core/'s node code), installing them at the repo root and making them resolvable. Verified by hiding the root copy: the warning returns; restore it and the dev/build startup is clean. A dynamic import of the backend does not help — Rolldown follows dynamic imports during config bundling too. The fix is the deps being resolvable, so the suppression is just removed and the invariant is documented in `vite.config.ts`. - Remove `clients/web/server/quiet-config-warnings.mjs` + `.d.mts` and its test - Restore the `dev` script to plain `vite` (drop the `--import` hook) - Remove the now-dead `build.rollupOptions.onwarn` UNRESOLVED suppressions (never fire: the Hono plugin is `apply: 'serve'`, out of the build graph) - Document why config-bundle resolution succeeds in `vite.config.ts` - Update AGENTS.md project tree Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
dc31c28102
commit
a1f40a4222
1 changed files with 14 additions and 178 deletions
|
|
@ -1,54 +0,0 @@
|
|||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
isBenignWarning,
|
||||
BENIGN_PAIRS,
|
||||
} from "../../../server/quiet-config-warnings.mjs";
|
||||
|
||||
// A representative Rolldown config-load warning block (header + code frame), as
|
||||
// captured from `vite dev` startup.
|
||||
function warning(dep: string, file: string): string {
|
||||
return (
|
||||
`${file} (8:36) [UNRESOLVED_IMPORT] Warning: Could not resolve ${dep} in ${file}\n` +
|
||||
` ╭─[ ${file}:8:37 ]\n` +
|
||||
` 8 │ import { readFile } from ${dep};\n` +
|
||||
` ╰─ Module not found, treating it as an external dependency\n`
|
||||
);
|
||||
}
|
||||
|
||||
describe("quiet-config-warnings / isBenignWarning", () => {
|
||||
it("matches each benign node-only dep warning", () => {
|
||||
for (const [dep, file] of BENIGN_PAIRS) {
|
||||
expect(isBenignWarning(warning(dep, file))).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("ignores non-UNRESOLVED output", () => {
|
||||
expect(isBenignWarning("VITE v8.0.0 ready in 603 ms")).toBe(false);
|
||||
expect(
|
||||
isBenignWarning("Sandbox (MCP Apps): http://localhost:61146/sandbox"),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("does not drop an UNRESOLVED_IMPORT for a different (real) dependency", () => {
|
||||
expect(
|
||||
isBenignWarning(
|
||||
"src/App.tsx (1:0) [UNRESOLVED_IMPORT] Warning: Could not resolve 'some-real-pkg' in src/App.tsx",
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("requires the matching source path, not just the package name", () => {
|
||||
// Same dep, but in an unrelated file → not silenced (guards over-matching).
|
||||
expect(
|
||||
isBenignWarning(
|
||||
"src/elsewhere.ts (1:0) [UNRESOLVED_IMPORT] Warning: Could not resolve 'chokidar' in src/elsewhere.ts",
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("uses repo-relative path fragments (not bare basenames)", () => {
|
||||
for (const [, file] of BENIGN_PAIRS) {
|
||||
expect(file).toContain("/");
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue