Skip to content

require.main is undefined when using --experimental-modules #21143

Closed
@mgalakos

Description

@mgalakos
  • Version: node v10.3.0
  • Platform: linux, windows, wsl

When running node with --experimental-modules flag, the global require object has a main property but its value is always undefined. Is this by design?

// index.js
console.log(require.main === undefined)
$ node index.js
false
$ node --experimental-modules index.js
true

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.questionIssues that look for answers.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions