We're updating the issue view to help you get more done. 

: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:

1 2 3 4 5 base.js:1357 Uncaught Error: Undefined nameToPath for iterall at visitNode (base.js:1357) at Object.goog.writeScripts_ (base.js:1369) at Object.goog.require (base.js:706) at index.html:7

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

1.10.238

Priority

Major