Fork me on GitHub
#cljs-dev
<
2018-05-31
>
symfrog18:05:54

It seems that when using the macro cljs.core/resolve with code splitting (:modules functionality) that there are conditions where it is possible that a module (A) that triggers the load of another module (B) is compiled before the defs of module B have been processed into cljs.env/*compiler*. This results in the defs in module B being empty at this point (https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L802) during the compilation of module A and causes the attempt at cljs.core/resolve to fail here https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L3288 . The attempt of module A to invoke the function in module B after load then fails at runtime. I have only encountered the issue with 1.10.238 (1.9.946 works correctly). Unfortunately, I have not been able to create a minimal case after several hours. Any ideas?

symfrog18:05:02

I have also tried master and the issue occurs in the same way as with 1.10.238

thheller20:05:25

@symfrog resolve does indeed generate unusable code. repro here https://github.com/thheller/cljs-bad-resolve