# Typescript Esm Import Fix

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

- Skill: `alexngai/typescript-esm-import-fix` (Agent Skill)
- Install (CLI): `npx skillmds@latest add alexngai/typescript-esm-import-fix`
- Raw SKILL.md: https://api.skillmd.com/api/skills/alexngai/typescript-esm-import-fix/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: alexngai (https://skillmd.com/u/alexngai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/alexngai/typescript-esm-import-fix

---


# 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`.

