Skip to content

Make --print respect --input-type=module #58994

@mmkal

Description

@mmkal

What is the problem this feature will solve?

This doesn't work, but it should:

node -p 'await Promise.resolve(123)' --input-type=module

Related to #45924 (comment) - but that was about --print and --eval. It seems to be fixed for --eval but not for --print

Note: bun -p 'await Promise.resolve(123)' works

What is the feature you are proposing to solve the problem?

Make a similar change to whatever fixed #45924

What alternatives have you considered?

bun

Note: node -e 'console.log(await Promise.resolve(123))' --input-type=module does work, but it's not always possible to use a console.log, especially when using node -p in a piped bash expression

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.never-staleMark issue so that it is never considered stale

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions