Concept
Node supports CommonJS (require) and ES modules (import). New projects should use ES modules with "type": "module" in package.json, and know how to load the occasional CommonJS package.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Modules in Node doing its job.
// package.json: { "type": "module" }
// money.js
export function format(cents) { return "$" + (cents / 100).toFixed(2); }
// server.js
import { format } from "./money.js"; // the extension is required
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const legacy = require("some-commonjs-package");Leaving the file extension off a relative import. ES modules in Node require "./money.js", and the error, "Cannot find module", does not say so.
Once a session shows you understand Modules in Node, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Modules in Node.