Skip to content

Add --import <module> flag for pre-loading ESM modules #40110

@Qix-

Description

@Qix-

Is your feature request related to a problem? Please describe.
-r can be used only on CommonJS modules, as documented here. Pre-loading an .mjs or an ESM module package is currently not possible.

Describe the solution you'd like
Either expansion of -r to support ESM modules (might break some people, not sure the scope of those changes) or the inclusion of a --module, -m <module> flag. Neither the long nor short arguments appear to exist in either Node or v8 according to the above docs (correct me if I'm wrong).

Describe alternatives you've considered
None, I perceive this to be a hole in the CLI option set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command line interface.esmIssues and PRs related to the ECMAScript Modules implementation.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

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions