Introduction

Modules

  • a .js file
  • can be imported in another .js file using require()
  • can export values that are then imported, e.g. object, function, class, etc.
  • can be package but doesn’t need to

Packages

  • a package.json and a module that is referenced as main property in package.json, by default is called index.js
  • packages are modules, but modules are not necessarily packages
  • device-independent packages, need to be coded properly using built-in modules, e.g. path.join() instead of string cocatening file paths ❗️

Resources