Skip to content

fix: patch dist ESM import extensions#3

Open
peterxing wants to merge 1 commit into
GOATNetwork:mainfrom
peterxing:fix/issue-2-node-esm-imports
Open

fix: patch dist ESM import extensions#3
peterxing wants to merge 1 commit into
GOATNetwork:mainfrom
peterxing:fix/issue-2-node-esm-imports

Conversation

@peterxing
Copy link
Copy Markdown

Summary

Fixes #2 by making the published dist/ Node ESM-compatible after TypeScript emits extensionless relative imports.

Changes:

  • add a post-tsc dist rewrite that appends .js to relative import / export ... from / dynamic import() specifiers when the emitted target exists
  • also rewrites .d.ts relative specifiers so published declarations match the runtime JS specifiers
  • replace the POSIX-only rm -rf dist clean command with a tiny Node clean script
  • keep source imports unchanged, so this is a minimal packaging fix rather than a repo-wide NodeNext migration

Verification

  • corepack pnpm install --frozen-lockfile --ignore-scripts
  • corepack pnpm run typecheck
  • corepack pnpm run build
  • corepack pnpm run test:unit — 25 files / 230 tests passed
  • corepack pnpm exec prettier --check package.json scripts/clean.mjs scripts/fix-esm-imports.mjs
  • corepack pnpm exec eslint scripts/clean.mjs scripts/fix-esm-imports.mjs
  • git diff --check
  • package self-import smoke after build:
    • import('@goatnetwork/agentkit') -> 162 exports
    • import('@goatnetwork/agentkit/core') -> 21 exports
    • import('@goatnetwork/agentkit/providers') -> 3 exports
    • import('@goatnetwork/agentkit/plugins') -> 129 exports

Note: full pnpm run lint still reports the existing repo-wide warnings plus an existing unused beforeEach error in tests/unit/x402-merchant.test.ts; the touched scripts lint cleanly.

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.

Published dist/ uses extensionless imports — package unusable via Node ESM

1 participant