Skip to content
Preptima
mediumConceptDesignMidSeniorStaff

How does Node load your modules, and how would you make a Node service use more than one core?

6 min readUpdated 2026-08-15

Answer

Short answer

ESM resolves asynchronously and exposes live read-only bindings, CommonJS resolves synchronously and returns a mutable object, and interop leaks in both directions. Extra cores come from worker threads for CPU work, cluster or replicas for connections, child processes for other programs.

Keep modules explicit in the answer because that is the concept the interviewer is actually trying to test.

Was this answer helpful?

Likely follow-ups

  • Your library needs to ship both a CommonJS and an ESM build. How do you avoid shipping two copies of its internal state?
  • You add a worker pool and throughput gets worse. What are the likely reasons?
  • Why is running four replicas under an orchestrator usually preferable to running cluster with four workers inside one container?
  • How do you hand an incoming socket to a worker process without proxying its bytes through the primary?

Related questions

Further reading