moduleResolution tells TypeScript how the host resolves module specifiers
Answer: Module resolution is the process of finding the file a module specifier refers to. The host — a runtime such as Node.js, or a bundler — defines the algorithm, and moduleResolution tells the compiler which algorithm to imitate.
Why the compiler has to be told
The ECMAScript specification says how import and export bind, but it leaves file lookup to the host. Runtimes and bundlers therefore differ, especially when they support both ESM and CommonJS. There is no single right answer, so the compiler learns the rules from configuration options.
module describes the expected module format. moduleResolution describes how specifiers map to files. TypeScript does not rewrite import specifiers on emit, because that mapping is host-defined.
The moduleResolution options
classic is the oldest mode and should not be used for new work. node10 (formerly node) models older CommonJS lookup, including node_modules and omitted .js extensions, and is a poor model of modern Node.js ESM rules.
node16 and nodenext follow modern Node.js, where ESM specifiers may not omit extensions or /index.js suffixes, while require still may. For those values, module and moduleResolution must match. bundler is for bundlers: it supports package.json imports and exports, but it does not require file extensions on relative import paths.
See also
Claims
- id: C1 claim: Module resolution is finding the file a module specifier refers to. source: S1 evidence: "finding the file referenced by a module specifier"
- id: C2 claim: The host, not the ECMAScript specification, defines module resolution. source: S1 evidence: "Module resolution is host-defined"
- id: C3 claim: moduleResolution selects the strategy used to resolve specifiers. source: S2 evidence: "Specify the module resolution strategy"
- id: C4 claim: The bundler mode does not require extensions on relative import paths. source: S2 evidence: "never requires file extensions on relative paths"
Sources
- [S1] TypeScript Modules: Theory. Microsoft (TypeScript Handbook). https://www.typescriptlang.org/docs/handbook/modules/theory.html . License: CC-BY-4.0. Accessed 2026-11-17.
- [S2] TSConfig: moduleResolution. Microsoft (TSConfig reference). https://www.typescriptlang.org/tsconfig/moduleResolution.html . License: CC-BY-4.0. Accessed 2026-11-17.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Microsoft (TypeScript Handbook), TypeScript Modules: Theory, CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE); Microsoft (TSConfig reference), TSConfig: moduleResolution, CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Microsoft (TypeScript Handbook), TypeScript Modules: Theory, CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE); Microsoft (TSConfig reference), TSConfig: moduleResolution, CC-BY-4.0 (https://raw.githubusercontent.com/microsoft/TypeScript-Website/v2/LICENSE).
Cite this
iinventedlight. 2026. "moduleResolution tells TypeScript how the host resolves module specifiers." iinventedlight Library, iil:note:n3z75vq2, version of 2026-11-17. https://iinventedlight.com/library/notes/typescript-module-resolution/. License: CC-BY-4.0.
@misc{iil_note_n3z75vq2,
author = {{iinventedlight}},
title = {{moduleResolution tells TypeScript how the host resolves module specifiers}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-17},
url = {https://iinventedlight.com/library/notes/typescript-module-resolution/},
note = {Permanent ID iil:note:n3z75vq2. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- typescript-module-resolution.table.json (table; CC-BY-4.0)
- typescript-module-resolution.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/typescript-module-resolution.md.