Typescript Esm Import Fix

Fix TypeScript ES module import errors by adding .js extensions to relative imports.

alexngai Updated
skill-tree CLI — list, search, read, and fork versioned agent skills

File contents

TypeScript ESM Import Fix

TypeScript with ES modules requires explicit .js extensions in relative imports — even though the source files are .ts.

  1. Add a .js extension to every relative import (./foo → ./foo.js).
  2. Keep it .js even when the file on disk is foo.ts.
  3. Run tsc --noEmit and confirm there are no module-resolution errors.

If you can't touch every import, set "moduleResolution": "bundler" in tsconfig.json.

alexngai/skill-tree commit c69cb2ef96

Frequently asked questions

npx get-skill add alexngai/typescript-esm-import-fix