Modules

A module is a code file that exposes its functions and values and imports others, splitting a program into reusable parts. Node has historically used CommonJS (require and module.exports) and also supports ES modules (import and export).

Example

const fs = require('node:fs');
module.exports = { lire };

Related concepts

The whole glossary