CommonJS (require, module.exports)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
CommonJS është sistemi i vjetër i moduleve në Node.js: require() për të importuar, module.exports për të eksportuar. Sot standardi është import/export (ES Modules), por do ta takosh në shumë projekte të vjetra.
EnglishEN
CommonJS is Node.js's older module system: require() to import, module.exports to export. Today the standard is import/export (ES Modules), but you'll meet CommonJS in lots of older projects.
Si ta mendosh
Si dy sisteme prizash: të dyja japin rrymë, por spinat janë të ndryshme.
Lexoje në anglisht
Like two socket standards: both give power, but the plugs are different.
Shembull kodijavascript
// i vjetër (CommonJS)
const fs = require("fs");
module.exports = { mblidh };
// i ri (ESM): import fs from "fs"; export { mblidh };