module resolution

How a runtime or tool turns the name in an import, such as ./util.js or express, into the exact file to load.

In more detail

The name is called a specifier: relative ones start with ./ or ../, while bare ones are looked up in installed packages. Build tools and type checkers must follow the same rules as the runtime, or they will disagree about which file is meant.

Example

Node.js looks bare specifiers up in node_modules, treats node: ones as built in, and requires full file extensions in ES modules.

Related terms

Taught in

References