Abstract
Terminologies
JavaScript Runtime Environment
- A environment to run Javascript, independent of Browser
Module
- Basically JavaScript Module
- The methods to be explicitly exposed, there are mainly 3 ways
module.exports.<METHOD_NAME> = <METHOD_NAME>
exports.<METHOD_NAME> = <METHOD_NAME>
(Syntactic Sugar)
exports.<METHOD_NAME> = <FUNCTION_DEFINITION>
CommonJS
- Use the keyword
const {...} = require()
- Loads the entire Module
ES modules
- Use the keyword
import {...} from ...
- Loads only the parts of a Module that are needed with the help of Tree Shaking (摇树)