Affects Version/s: None
Fix Version/s: None
Environment:macOS 10.13.6, java 1.8.0_161
The "semantic-ui-react" node module, when used as an npm-deps, produces code that fails to load. Minimal reproducing case I could come up with:
Note: I see exactly the same issue with current master, which at the time of writing is commit 81a1ea12 installing locally as 1.10.394.
Files organized as:
produces code that fails to load in the following way. First, modules that have an index.js file seem to be missing a provide statement; for example:
gets required elsewhere as the "full path" without the final "index":
which produces an error saying that nameToPath cannot find the module "module$Users$gary$sparrho$cljs_bug_report$node_modules$semantic_ui_react$dist$es$addons$Confirm". I managed to fix that by patching the ClojureScript compiler (adding the additional goog.provides to cljs.closure/add-converted-source if the current source ends in index, mirroring the patch in
CLJS-2205), only to find out that there is a second problem (which makes me doubt my approach is the proper way to fix this) in that the code produced actually then goes and tries to use the module with its full name, including the index part:
which throws an error saying that the variable module$Users$gary$sparrho$cljs_bug_report$node_modules$semantic_ui_react$dist$es$addons$Confirm$index is not defined.
I am completely unfamiliar with all of the ClojureScript compiler, the Google Closure compiler or the ES6 module system, which makes it very hard for me to investigate further. I have verified that at the point of generating the requires and provides calls (cljs.closure/add-converted-source) the Closure object representing the dependencies does not contain the index part at the end, which is consistent with the goog.requires calls that are generated. The goog.provides calls seem to be generated independently of the Closure compiler, based on analysis of the js files done in src/main/cljs/cljs/module_deps.js. What I cannot figure out (and therefore where I am blocked) is what piece of code generates the JS code that tries to access the "wrong" variable name. Maybe this is a bug in ClojureScript not generating the right goog.requires calls, or maybe this is a bug in Closure not using the same name for the JS variables as the symbols it generates on its Require objects.