package.json, npm, and scripts

The manifest at the root of every project

You met package.json in the welcome module β€” it's the project's manifest, the equivalent of Swift's Package.swift. It names the project, declares which packages it depends on, and defines the scripts you run. Every command in this course runs from a folder that has one.

The "type": "module" line is the one to remember: it tells Node to treat every .js file as ESM (import/export). Without it, Node defaults to CommonJS (require). That single field is why the import syntax from lesson 1 just works.