Skip to content

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

Description

@Avaq
  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.experimentalIssues 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