logo

ES6 Modules

Practical module patterns, live bindings, and dynamic imports.

Short explanation

ES6 modules bring native module support to JavaScript with static analysis benefits and live bindings that reflect updates.

Syntax example

// dynamic import
import('./utils.js').then(mod => mod.doThing());

How JS handles it internally

Static imports allow bundlers and tools to analyze dependency graphs. Live bindings mean imports reference the original variable, not a snapshot.

FAQ

Q: What are live bindings?

A: Imports reference the exported variable itself, so if the exporting module updates the variable, the importing module sees the change.