intermediate
Module resolution
Browser URLs, Node package resolution, exports maps, bundler aliases, and ESM/CJS interop.
Resolution maps an import specifier to a file or package entry. Browsers load URLs (or import maps). Node reads `package.json` `exports`, `main`, `module`, extensions, and ESM/CJS mode.
Bundlers add aliases and virtual modules. A path alias in Vite is not understood by Node or Jest until each tool is configured.
`exports` maps can block deep imports into package internals.
On interviews, explain the concept with a concrete example and name the runtime behavior interviewers probe.
Common pitfalls include mixing similar APIs and forgetting edge cases during live coding.
The trade-off is often clarity versus performance or safety versus convenience.
Checklist:
- Identify the runtime resolver.
- Check package exports before deep imports.
- Configure aliases in every tool chain.