CommonJS

CommonJS is a module system that is traditionally used in Node.js environments. It uses a special function require for importing, and module.exports for exporting. TypeScript can compile code to CommonJS by setting the compiler target to "CommonJS".

Module Resolution

TypeScript's module resolution determines how module imports are resolved to actual files. It supports two strategies: "Classic" and "Node".

The "Node" strategy mimics Node.js module resolution.

The "Classic" strategy is the default for projects not targeting Node.js.

Was this page helpful?