@bhauman ClojureScript 1.9.293 introduced require
macros that can be called outside of the ns
form
we also replaced the REPL special functions by these in cljs.repl
I'm seeing weird behavior in the Fighweel REPL with ClojureScript 1.9.293 and some require
s
i.e. if I have a ClojureScript dependency in the classpath that is otherwise not used in my Figwheel build, require
fails with this error:
#object[Error Error: goog.require could not find: bidi.bidi]
figwheel$client$file_reloading$figwheel_require (jar:file:/Users/anmonteiro/.m2/repository/figwheel/figwheel/0.5.6/figwheel-0.5.6.jar!/figwheel/client/file_reloading.cljs:187:30)
^ in this case I'm trying to require bidi.bidi
but I don't (yet) have it in any of the project's namespaces
(require '[om.next :as om])
, for example, works just fine (because it's a dependency in some namespaces in the project
@anmonteiro: and this same case works in the regular cljs repl?
@bhauman yeah
Hmmm frustrating this should just work
Have you eliminated nREPL and other environmental complications?
@anmonteiro: ^
yeah
Hmmmm, I think there is something wrong with the expectations here.
if require compiles down to goog.require
Thinking out loud here: Then bidi is going to need to be in the client side dependency map. So the result of calling require will have to compile bidi and update the dependency map, hmmm OK I can see several ways this might fail. I'll take a look.
@bhauman I think you're replicating a lot of stuff from cljs.repl
there's probably something there you also need to replicate but aren't currently?
Nope I use cljs.repl straight with various options set.
here's an example: https://github.com/bhauman/lein-figwheel/blob/master/sidecar/src/figwheel_sidecar/repl.clj#L201
But on the client side I have to some crazy stuff for live reloading
this one changed to accomodate for the new stuff, e.g. require
, etc
@bhauman if you're going to rely on internal details maybe you can call private stuff via the var? then everything is updated automatically
e.g. (#'cljs.repl/some-private-fn foo bar baz)
Absolutely
I wrote that before I knew about that trick
Thanks for the pointer that helps.