If in a .cljs file I define a file like this:
main.cljs
(ns project.main
(:use [project.secondfile :only [my-var]]))
(js/alert my-var)
secondfile.cljs
(ns project.secondfile)
(def my-var "Hi")
I get a "Referred var project.secondfile/my-var does not exist at src-cljs/main.cljs". However, it works normally in the browser as both are compiled (and with compilations :whitespace they can reference each other just fine). But obviously, it doesn't work in the bREPL as they aren't referring to each other.
Is this something unavoidable or I'm doing something wrong?
Thanks!
I've tried your code and works fine in my current configuration. I've had other issues similar to your question and in those cases you can try to compile and load the
secondfile.cljs
into the brepl before you try to compile and load themain.cljs
. In this case, this trick works fine. Maybe the problem is that thesecondfile.cljs
(and thedef my-var
) didn't exist before the cljsbuild compilation, so when you tried to use thismy-var
this code wasn't availableI hope this helps you
Juan