Fork me on GitHub
#cljs-dev
<
2017-11-08
>
plexus10:11:37

Hey folks, I've been poking around the ClojureScript compiler trying to debug an issue for the last day or so, and I think I could use some help/pointers...

plexus10:11:37

We're trying to load fuzzy.js as a commonjs module

{:file "clj/editor/src/js/vendor/fuzzy.js"
                    :provides ["fuzzy"]
                    :module-type :commonjs}

plexus10:11:12

(ns editor.components.ui.autocompleter
  (:require [fuzzy]))

(fuzzy ...)

plexus10:11:11

I got a small standalone example where that works fine, but in our actual setup I'm failing to get it to work. The fuzzy.js is compiled fine, and getting munged to goog.provide("module$home$arne$tmp$fuzzy_test$js$vendor$fuzzy");

plexus10:11:49

but it's not showing up cljs_deps.js

plexus10:11:37

so in the (working) self contained example it looks like this

plexus10:11:39

goog.addDependency("../js/vendor/fuzzy.js", ['module$home$arne$tmp$fuzzy_test$js$vendor$fuzzy'], []);
goog.addDependency("../my/test.js", ['my.test'], ['module$home$arne$tmp$fuzzy_test$js$vendor$fuzzy', 'cljs.core']);

plexus10:11:40

but where I'm trying to get it to work it looks like this

goog.addDependency("../editor/components/ui/autocompleter.js", ['editor.components.ui.autocompleter'], ['cljs.core', 'fuzzy']);

plexus10:11:19

and so in the generated code it's spitting out goog.require('fuzzy'); instead of goog.require("module$home$arne$tmp$fuzzy_test$js$vendor$fuzzy");

plexus10:11:45

so my question at this point is: where in the compiler is this renaming happening? so I can perhaps start looking from there