Module (require / import)

say it: “MOJ-ool” /ˈmɒdʒuːl/ or “rih-KWYR or IM-port” /rɪˈkwaɪər ɔːr ˈɪmpɔrt/

A file that shares code through exports.

What is Module (require / import)?

A module is a file whose exports other files can use. Node supports CommonJS (require) and ES modules (import).

import express from 'express';          // ES module
const fs = require('node:fs');           // CommonJS

Level: Novice · More Node.js terms at this level

Updated