:npm-deps using ES6 modules with .mjs extensions are not detected correctly

Description

Several modern JS libraries have adopted the .mjs extension for ES6 modules. Two examples of such libraries are https://github.com/leebyron/iterall/ and https://github.com/graphql/graphql-js/.

Indexing packages that use this file extension (e.g. for their index.mjs) and adding them to the compiler environment is currently broken. As a result, these packages will not be resolvable at runtime, leading to errors such as this:

I've created a minimal repository to reproduce the issue here: https://github.com/Jannis/cljs-npm-deps-mjs-issue.

I'll attach a patch with a fix and two tests (one to verify indexing, one to verify building) shortly.

Environment

Tested with both ClojureScript 1.10.64 and ClojureScript master (4375a63)

Status

Assignee

Unassigned

Reporter

Jannis Pohlmann

Labels

None

Approval

None

Patch

None

Affects versions

Priority

Major
Configure