JavaScript modules
Widely available since 2020-11-09
JavaScript modules allow code to be organized into reusable units. Modules use import
to load other modules and export
to declare what is available to import from other modules. In HTML, modules are loaded with <script type="module">
.
Learning resources on MDN
Browser support (view on caniuse.com)
- Chrome 61 Released on 2017-09-05
- Chrome Android 61 Released on 2017-09-05
- Edge 16 Released on 2017-10-17
- Firefox 60 Released on 2018-05-09
- Firefox for Android 60 Released on 2018-05-09
- Safari 11 Released on 2017-09-19
- Safari on iOS 11 Released on 2017-09-19
Surveys
- State of HTML 2024: web_components/web_components_features question
- State of HTML 2024: web_components/web_component_features question
- State of HTML 2024: features/all_features question
- State of HTML 2023: web_components/web_components_main_features question
- State of HTML 2023: features/all_features question
Specifications
- HTML (#javascript-module-script), from HTML Workstream (WHATWG).
- ECMAScript® 2025 Language Specification (#sec-modules), from TC39 (Ecma International).
View web-platform-tests results for this feature - View the feature source file (dist) - Edit the feature - Report an issue about this feature