Missing/Incorrect provides for node module required from ES6 module

Description

Affects: 1.10.271 with CLJS-2402.patch

I have a minimal repro repo here: https://github.com/au-phiware/cljs-in-js-in-cljs

Description of problem

The compiler appears to know node modules that are required from foreign libs by two different names, but the cljs_deps.js file only uses one of them. In the repro case below, unique-random is referenced as both module$unique_random and module$usr$src$cljs_in_js_in_cljs$node_modules$unique_random$index in the compiled output of the foreign lib (}target/main.out/es6/hello.js}), but {{cljs_deps.js only specifies module$usr$src$cljs_in_js_in_cljs$node_modules$unique_random$index as its provides.

Steps to reproduce the problem

Consider the following source files:

src/hello/core.cljs

es6/hello.js

build.clj

Execute cljs:

Expected outcome

cljs should produce nothing to the standard output, exit cleanly and write the following files (approximately).

target/main.js

target/main.out/cljs_deps.js

target/main.out/es6/hello.js

target/main.out/hello/core.js

Caveat

The expected outcome was derived from the actual outcome with the minimal set of changes required to produce the desired outcome (i.e. working in the browser without error).

Alternatively, all references to module$unique_random could be replaced with module$usr$src$cljs_in_js_in_cljs$node_modules$unique_random$index, for the same desired outcome.

Actual outcome

The cljs_deps.js file is missing the module$unique_random provides name for the node module.

target/main.out/cljs_deps.js

The following is the diff output for clarity.

diff --git a/target/main.out/cljs_deps.js b/target/main.out/cljs_deps.js

Furthermore, if optimisations is turned on (e.g. :optimizations :simple) the following error is observed from cljs.

stderr

Environment

Linux 4.16.2 #23 SMP Mon Apr 30 11:01:40 AEST 2018 x86_64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz GenuineIntel GNU/Linux

Assignee

David Nolen

Reporter

Corin Lawson

Approval

None

Patch

Code

Priority

Major
Configure