es6-modules Flashcards
How are ES Modules different from CommonJS modules?
Syntax: ES Modules use import and export statements to manage exports and imports of modules, while CommonJS uses require and module.exports.
Dynamic vs Static: CommonJS exports and requires are dynamically resolved at runtime, while ES Modules are statically analyzed at build time.
Load Order: CommonJS modules are loaded synchronously and blocking, while ES Modules are loaded asynchronously and non-blocking.
Default exports: ES Modules have a single default export per module, while CommonJS modules can have multiple exports.
Cross-Module Mutability: CommonJS modules share state between modules, while ES Modules have isolated state.
What kind of modules can Webpack support?
both Es6 and common.JS