Chapter XXII · Modules

ES Modules

ES Modules (ESM) is the official standard ECMAScript module system built directly into JavaScript using `import` and `export`.

01 How It Works

Think of standardized international shipping container ports compatible across global logistics networks.

ESM files operate in strict mode automatically, support asynchronous loading, and use lexical top-level scopes.

example.js
<script type="module" src="app.js"></script>
  1. 1. Enable ESM via `