import and export

The statements that share code between modules: export makes a name available, import brings it into another file.

In more detail

import { add } from "./math.js" loads a value. When an import brings in only types, the emitter may delete it; import type makes that explicit. Import statements are resolved before any code in the file runs.

Related terms

Taught in

References