JavaScript Modules
Overview
About this index
ES modules split code into files that export and import bindings. Use static import/export for structure, and import() when you need to load later.
Index
Topics
| Topic | Summary |
|---|---|
export | named exports and default exports from ES modules. |
import | named imports, default imports, and import aliases in ES modules. |
import() | load a module on demand, get a Promise of the module namespace. |
import.meta | module metadata such as import.meta.url in ES modules. |
import attributes | with { type: 'json' } metadata. |
import defer | defer module evaluation. |
import source | source-phase imports. |
Modules guide | mental model for ES modules. |
Frequently Asked Questions
Use <script type="module" src="...">.
These pages focus on ES modules. Node still supports require in CommonJS files.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful
