Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Experimental module resolution inconsistency between --eval and file #28160

Copy link
Copy link
@Avaq

Description

@Avaq
Issue body actions
  • Version: v12.3.1
  • Platform: Linux thinkpad-avaq 4.19.47 #1-NixOS SMP Fri May 31 13:46:35 UTC 2019 x86_64 GNU/Linux

Preparation

  1. Go to a temporary directory: cd $(mktemp -d)
  2. Install Fluture or any other module that has a "main" field without file extension, and contains a .js main file as well as a .mjs main file: npm install fluture@11.0.1

Reproducing

Run the following two shell scripts:

node --input-type=module \
     --experimental-modules \
     --eval 'import Future from "fluture"; console.log(Future)'
echo 'import Future from "fluture"; console.log(Future)' > index.mjs
node --experimental-modules index.mjs

Expected result

The output of both shell scripts is the same.

Actual result

The first script errors with Error: Cannot find package 'fluture' imported from, and the output from the second shows that the module resolver loaded the CommonJS version of the package into the module.

/cc @ljharb

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.