Lesson content
Read, practise, then check your understanding
ES modules provide file scope and explicit dependency graphs. Named exports support several bindings; a module has at most one default export.
Boundaries
// math.js
export const square = value => value * value;
// app.js
import { square } from "./math.js";
console.log(square(6));
const charts = await import("./charts.js");
Imports are live read-only views of exported bindings. Static imports enable analysis, ordering, and tree-shaking; dynamic import returns a Promise and supports code splitting. Browser modules need correct URLs/MIME/CORS; Node resolution follows package rules. Avoid circular dependencies and expose stable domain APIs rather than internal file structure.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.