Skip to content

Glossary: Node.js Basics

CommonJS

Also written: require, __dirname, __filename

Node's older module system, which loads code with `require` and provides the `__dirname` and `__filename` variables. Modern code usually uses ES modules (`import`/`export`) and `import.meta.dirname` instead.

Where the book teaches it

Related terms

import.meta.dirname