Skip to content

REPL, -e, and piped stdin globals are wrong: ,missing exports, module, etc. #1282

@cspotcode

Description

@cspotcode

Expected Behavior

ts-node --interactive -e "<expression>" should behave the same as node --interactive -e "<expression>"

-e should be evaluated with exports, etc.

Actual Behavior

exports is not defined during the evaluation of a -e expression.

Steps to reproduce the problem / Minimal reproduction

ts-node --interactive -e "console.log(exports, __filename)"
node --interactive -e "console.log(exports, __filename)"

Notes

Looks like a blind spot in our REPL logic in bin.ts We should check that all the module-specific variables, exports, __filename, etc match nodejs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions