[CLJS-1682] :foreign-libs with module conversion does not works properly if it is used form deps.cljs Created: 13/Jun/16 Updated: 23/Sep/16 Resolved: 23/Sep/16
|Affects Version/s:||1.9.36, 1.9.76|
|Labels:||closure, compiler, foreign-libs|
When :foreign-libs is used for consume commonjs (or amd) modules from clojurescript using the `deps.cljs` mechanism, an unexpected "internal compiler error" is raised. When the same configuration is attached on the build script, everything works as expected.
Simple way to reproduce that, create sample directory tree:
Download the latest compiler or copy the recently build one from master:
Create the sample cljs file:
Create the sample commonjs module:
Create the build script (that works):
And compile this using the following command:
This will generate successfully the final artifact that can be successufully executed with node:
But, if you remove the `:foreign-libs` from the build script and create a new `src/deps.cljs` file
And try compile it:
|Comment by Andrey Antukh [ 13/Jun/16 5:42 AM ]|
Also happens with `cljs.jar` build from master.
|Comment by Rohit Aggarwal [ 14/Jun/16 5:40 AM ]|
[Compiler noob here]
Here is what is causing the issue:
In src/main/clojure/cljs/closure.clj in process-js-modules function, in the first case :foreign-libs is being set in opts and in the second failing case :ups-foreign-libs is being set in opts.
I am investigating the root of this.
|Comment by Rohit Aggarwal [ 14/Jun/16 6:11 AM ]|
A fix is to that set foreign-libs keyword in opts to a union of both foreign-libs and ups-foreign-libs.
I've verified that it works for both the above given examples. But I don't know enough about the compiler to propose this change.
|Comment by Rohit Aggarwal [ 14/Jun/16 10:57 AM ]|
Attaching patch with fixes this problem. The patch keeps the two sets of data (ups-foreign-libs, foreign-libs) separate.
I've run all the tests and they pass.
|Comment by David Nolen [ 23/Sep/16 2:31 PM ]|