TypeScript Compiler Options
moduleResolution — TypeScript compiler option
Chooses lookup algorithm. Node modes model import and require resolution; bundler supports package maps and extensionless relative imports. Node ESM requires explicit runtime extensions for relative imports; bundler acceptance does not prove Node loading. Default (5.8.3): depends on module. Create the labeled files in an isolated local project and run tsc -p tsconfig.json. Expected: no diagnostics; emitted files: none. Local multi-file fixture, not a single-file editor.
Formal Syntax & Structure
typescript syntaxtypescript
{ "compilerOptions": { "moduleResolution": "Bundler" }}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| moduleResolution | classic | node10 | node16 | nodenext | bundler | Set in compilerOptions; default: depends on module. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "ESNext", "strict": true, "types": [], "noEmitOnError": true, "noEmit": true, "moduleResolution": "Bundler" }, "files": [ "main.mts" ]}// File: main.mtsimport { value } from "./value"; const checked: number = value;// File: value.tsexport const value = 7;