Skip to content

import.meta.main does not work when the entry point is Typescript #58809

Closed as duplicate of#58660
@vassudanagunta

Description

@vassudanagunta

Version

v24.2.0

Platform


Subsystem

No response

What steps will reproduce the bug?

  1. create two files, main.js and main.ts, both with the same content:

    console.log(import.meta.main)
  2. run node main.js

  3. run node main.ts

  4. observe that main.js prints true while main.ts prints false

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

node main.ts behave exactly like node main.js, and import.meta.main should behave as it says it should.

What do you see instead?

node main.js prints true.
node main.ts prints false.

Additional information

#57226, #49440

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions