User hit at dev-server startup: Module "node:fs" has been externalized for browser compatibility. Cannot access "node:fs.readdirSync" in client code. Chain: apps/web's design-parser.ts imports `parseModelOutput` from `@zseven-w/pen-ai-skills`; main barrel re-exports everything from `./corpus`; `./corpus/index.ts` re-exports `loadCorpus` which imports `node:fs`. Vite pulls the whole graph into the client bundle → crash on the first browser-side module evaluation. Fix: remove `loadCorpus` from `./corpus/index.ts`. The barrel now only exposes pure-string helpers (parser, scorer, aggregator, types) — all browser-safe. `loadCorpus` stays in `corpus-loader.ts` but Node-only consumers (`scripts/ab-corpus/run.ts`) import it directly via a relative path. Package.json only declares the main entry in `exports`, so sub-path imports via the package name fail at runtime (pkg runs under Bun for the harness) — relative file path avoids that gate. Verification: - `bun scripts/ab-corpus/run.ts --only X --dry-run` still runs end to end - tsc --noEmit exit 0 - Full test suite 1866/1866 Browser-side verification (user): restart Vite dev server — the design-parser import no longer pulls node:fs through the barrel. |
||
|---|---|---|
| .. | ||
| ab-corpus | ||
| bundle-skill.ts | ||
| ensure-agent-native.cjs | ||
| patch-srvx-bun.ts | ||
| publish-beta.sh | ||
| unpublish.sh | ||