JavaScript Modules

Beginner
4 guides
Updated: Nov 2026

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.

Topics

TopicSummary
exportnamed exports and default exports from ES modules.
importnamed imports, default imports, and import aliases in ES modules.
import()load a module on demand, get a Promise of the module namespace.
import.metamodule metadata such as import.meta.url in ES modules.
import attributeswith { type: 'json' } metadata.
import deferdefer module evaluation.
import sourcesource-phase imports.
Modules guidemental 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.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful