module (compiler option)

The compiler option that says which module system the output uses and, with NodeNext, how each file is treated.

In more detail

Values such as NodeNext, ESNext and CommonJS decide whether import and export are kept or rewritten to require. With NodeNext, each file is treated as an ES module or CommonJS according to its extension and the nearest package.json type field. TypeScript 6.0 changed the default to esnext.

Related terms

Taught in

References