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
Specifications
- HTML Standard (#javascript-module-script), from HTML Workstream (WHATWG).
- ECMAScript Language Specification (#sec-modules), from TC39 (Ecma International).