Modules in Node.js

Modules in Node.js: Modules: import and export, Node's Built-In Modules, and the require You'll Still See.

Updated

  1. Modules: import and export (Apprentice): A module is a file that shares only what it exports; another file imports it by name (a named export) or under a name it picks (the default export), and a package.json in Node or type="module" on a page makes it run.
  2. Node's Built-In Modules, and the require You'll Still See (Apprentice): Node comes with built-in modules for files, file names, the computer and everyday helpers, imported with node in front of their names, and older code shares modules with require and module.exports, which you can read and rewrite as import and export.