Skip to main content
Process.mainModule - node__process.d.ts - Node documentation
property Process.mainModule

Usage in Deno

```typescript import { type Process } from "node:node__process.d.ts"; ```
Deprecated
Since v14.0.0 - Use `main` instead.
The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at runtime, `require.main` may still refer to the original main module in modules that were required before the change occurred. Generally, it's safe to assume that the two refer to the same module. As with `require.main`, `process.mainModule` will be `undefined` if there is no entry script.

Type

Module | undefined