CodeZettaInterview Hub

Node.js · Modules · Fresh / Intern · Concept

How does Node resolve `require('pkg')`?

Short Interview Answer

Looks at node_modules hierarchy, package.json main/exports, and core modules — algorithm is hierarchical.

Detailed Explanation

Understanding exports maps and conditional exports prevents dual-package hazards. Core modules take precedence by name.

Did you know this answer?