I'm struggling to get cljs working with the newest duct
I run cider-jack-in-clj&cljs
and run (go)
in dev.clj
, which compiles the cljs once, but doesn't watch src
to recompile.
Then I try to run this in the clj repl that is supposed to become a cljs repl.
user> (require '[duct.repl.figwheel :refer [cljs-repl]])
nil
user> (cljs-repl)
Execution error (IllegalStateException) at cemerick.piggieback/cljs-repl (piggieback.clj:234).
Can't change/establish root binding of: *cljs-repl-env* with set
When I run cider-jack-in-clj&cljs
it asks which kind of repl, with the options figwheel
, figwheel-main
and others. The above error appears when I choose figwheel-main
. If I choose figwheel
it errors on startup complaining about invalid cljsbuild config
user> Execution error (ExceptionInfo) at figwheel-sidecar.config/raise-one-error (config.clj:478).
------ Figwheel Configuration Error ------
Missing required key :cljsbuild at path []
{:cljsbuild ...
^---- The required key :cljsbuild is missing
}
So, should I choose figwheel
, figwheel-main
or something else at jack-in
time? Do I need to set any extra variables in .dir-locals.el
to make this work?
@madstap It looks like you're using cemerick.piggieback rather than cider.piggieback. You might need to update your project.clj file and replace the piggieback dependencies with:
:dependencies [[cider/piggieback "0.3.10"]]
:repl-options {:init-ns user
:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}
I am using the lein new duct from yesterday, so that's what my project.clj looks like
I'm also on cider 0.20.0
Let me quickly check something.
Ah, whoops. It looks like the server.figwheel package wasn't updated to user cider.piggieback. Which is weird, because it worked fine for me in testing... perhaps some sort of dependency conflict that resolved in my favour but not in yours.
@madstap Unfortunately I don't think I can fix this until Thursday, but could you add an issue to https://github.com/duct-framework/server.figwheel so I don't forget?
Yeah, I saw that there were some issues with cider/nrepl/lein]
Or you can open a PR to update the dependencies if you want.
What would a fix involve, just updating the deps?
I can make a PR, no problem
Deps and requires
So here: https://github.com/duct-framework/server.figwheel/blob/master/project.clj
And here: https://github.com/duct-framework/server.figwheel/blob/master/src/duct/server/figwheel.clj
I'm not sure whether that's your only problem, but it seems like a good place to start. I've run into compatibility problems with piggieback as well since the Lein 2.8.3 update.
Yeah, I ran into some issues as well on another project which were fixed by upgrading cider and lein to the latest (so I didn't look any more into it)
Just to confirm though, when I run cider-jack-in-clj&cljs
I should choose figwheel-main
as the cljs repl type?
I need to investigate, but I believe there's an option for setting the commands you need to start the cljs repl.
One sec while I check.
Hm, Cider docs have no information on what the option does.
In another project I had some incantation in .dir-locals, some string with (do (require ',,,) (,,)
Ah, okay, they've changed how the whole cljs setup works. Not very backward-compatible of them, really.
And I'm not seeing a way to support the old functionality...
I'll ask about this on the Cider channel.