Skip to content

fix(build-manifest): import compiled JS from dist/clis/ instead of raw TS#926

Merged
jackwener merged 2 commits intomainfrom
fix/build-manifest-import
Apr 10, 2026
Merged

fix(build-manifest): import compiled JS from dist/clis/ instead of raw TS#926
jackwener merged 2 commits intomainfrom
fix/build-manifest-import

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • build-manifest was dynamically importing .ts source files from clis/, but Node's type stripping doesn't rewrite .js.ts in import specifiers, causing "Cannot find module" for any adapter with relative imports (./utils.js, ./shared.js)
  • 268 warnings on every build, and half of all adapters silently skipped (254 vs 532 entries)
  • Fix: scan dist/clis/ (compiled JS) instead of clis/ (raw TS) after tsc runs
  • Falls back to clis/ if dist/clis/ doesn't exist
  • sourceFile in manifest correctly maps back to the original .ts path

Test plan

  • npm run build — zero warnings, 532 entries (was 254)
  • vitest run src/build-manifest — 4/4 tests pass
  • Manifest entries include correct sourceFile paths (.ts not .js)

…w TS

Node's type stripping does not rewrite '.js' → '.ts' in import
specifiers, so dynamically importing .ts source files fails whenever
they contain relative imports like './utils.js'.

Switch to scanning dist/clis/ for compiled .js files after tsc runs.
This eliminates all 268 "Cannot find module" warnings and increases
manifest entries from 254 to 532 (previously half were silently skipped).
The runtime resolves BUILTIN_CLIS to dist/clis/ (relative to
dist/src/main.js), so discoverClis() looks for manifest at
dist/cli-manifest.json. Previously it was written to the package root
where the runtime never found it — manifest was effectively unused,
always falling through to filesystem scanning.
@jackwener jackwener merged commit b45a64d into main Apr 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant