es6-modules Flashcards

1
Q

How are ES Modules different from CommonJS modules?

A

ES6 modules use the import keyword with the functions or classes that have been exported then the from keyword and a relative path to the file or directory. CommonJS modules use require(‘export name’) and assign that to constant variables for imports. For exports module.exports = {
prop1: func1,
}
CommonJS is community supported and ES Modules are browser supported.

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

ECMAScript modules, CommonJS modules, and AMD modules.

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