es6-modules Flashcards

1
Q

How are ES Modules different from CommonJS modules?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What kind of modules can Webpack support?

A

both Es6 and common.JS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly