Phase 2 · Node.js Fundamentals
TopicsModules (CommonJS vs ESM)
Part of the Backend Developer Roadmap.
Summary
Node's two module systems — the original `require`/`module.exports` (CommonJS) and the newer standard `import`/`export` (ES Modules) — with different loading behavior and syntax.
How to Learn This
- 1Write the same small module in both CommonJS and ESM syntax.
- 2Learn how to enable ESM in a Node project (`"type": "module"` in package.json).
- 3Understand why CommonJS is synchronous and ESM is asynchronous under the hood.
More topics in Node.js Fundamentals
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — free on the InsideEdge app.