In ES modules (ESM), top-level this is undefined. In CommonJS, top-level this refers to the module's exports object.
In ECMAScript modules (ESM), the top-level this is undefined, because modules run in strict mode by default. In CommonJS (Node.js), the top-level this refers to the module's exports object. This difference stems from how each module system executes code. Example: // ESM: console.log(this); // undefined; // CommonJS: console.log(this); // {} (module.exports).