.js-to-.ts Import Extension Convention
- Entity ID:
ent-20260420-b01a0000001d - Type:
pattern - Scope:
shared - Status:
active - Aliases: .js extension maps to .ts, ESM-compliant TS imports
Description
Codebase-wide convention of writing ESM imports with .js extensions (import x from './foo.js') even though the source is TypeScript. Required by Node's strict ESM resolver but must be unwound at build time. The esbuild build resolves this via resolveExtensions: ['.tsx', '.ts', '.jsx', '.js', '.json'] so ./foo.js imports are first tried as ./foo.tsx then ./foo.ts.
Key claims
- esbuild replaces Bun's bundler for rebuild via three targeted overrides
- Source codebase uses .js-extension imports that esbuild maps to .ts
Relations
- esbuild Build System (scripts/build-bundle.ts) --[handles]--> .js-to-.ts Import Extension Convention