Bundler module resolution for bundled apps
Rule
Set module to ESNext and moduleResolution to bundler. Relative imports are extensionless. This applies only to code a bundler (Vite, Metro) always processes; code that Node runs directly follows STD-TS-002.
Do
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler"
}
}import { useInbox } from './hooks/use-inbox';Don’t
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext"
}
}Rationale
The bundler resolves imports, so .js extensions on .ts sources add noise without fixing anything. Splitting by archetype keeps libraries correct for Node consumers and keeps app code idiomatic.
Related
- STD-TS-002: the setting for Node-run code
- CGD-01