Node.js Module System Explained
Explore CommonJS modules, ES modules, and how to import and export functionality across files in Node.js.
Organize Your Code with Modules
As apps grow, one giant file gets messy. Modules split code into small, reusable, focused pieces. Node supports two systems: CommonJS and ES Modules.
CommonJS: `require()` & `module.exports`
CommonJS is Node's original module system: require() pulls code in, module.exports pushes code out. Import what you need, export what you offer.
All lessons in this course
- Introduction to Node.js & NPM
- Node.js Module System Explained
- Asynchronous JavaScript & Event Loop
- Working with the File System & Streams