ES Modules

GPTKB entity

Statements (39)
Predicate Object
gptkbp:instanceOf JavaScript module system
gptkbp:allows top-level await (from ES2022)
default exports
named exports
gptkbp:alsoKnownAs gptkb:ECMAScript_Modules
gptkbp:canBe gptkb:Node.js
browsers
gptkbp:canBeBundledBy gptkb:Parcel
gptkb:Rollup
gptkb:Webpack
gptkbp:canBeTranspiledBy gptkb:Babel
gptkbp:compatibleWith top-level await (before ES2022)
circular dependencies as easily as CommonJS
dynamic require
gptkbp:enables code splitting
tree shaking
asynchronous module loading in browsers
modular JavaScript code
static analysis of dependencies
gptkbp:exportSyntaxExample export function foo() {}
gptkbp:fileExtension .js
.mjs
https://www.w3.org/2000/01/rdf-schema#label ES Modules
gptkbp:imported script type="module" in HTML
gptkbp:importSyntaxExample import {foo} from './foo.js';
gptkbp:introducedIn gptkb:ECMAScript_2015
gptkbp:replacedBy CommonJS in some environments
gptkbp:specifies gptkb:ECMA_International
gptkbp:supportedBy modern browsers
Node.js (from version 12+ with .mjs extension)
gptkbp:supports export syntax
import syntax
gptkbp:uses strict mode by default
gptkbp:bfsParent gptkb:HTML_shadow_DOM
gptkb:HTML_Custom_Elements
gptkb:HTML_Imports
gptkb:HTML_Shadow_DOM
gptkb:HTML_imports_(deprecated)
gptkbp:bfsLayer 5