1
votes

I've been trying to learn how to properly debug ClojureScript. I'm sorry if this is a noob question, maybe it's so noob that no one else ever needs to ask it, but I can't find a direct answer anywhere. I've followed these setup tutorials:

https://github.com/shaunlebron/How-To-Debug-CLJS http://teamcoding.com/blog/2015/03/10/clojurescript/

They both setup a solid environment with a repl, but whenever I execute any code, the output and (more importantly) the errors always show up in the repl and not in the console. The only thing I can get to show up in console is print statements using (enable-console-print!).

I would like everything to show up in the console, no matter what, so that I can use source-maps to identify problem areas.

Thanks guys and gals!

1
That first reference is outdated and the second is for Om when Om Next is about to become beta. The current standard way of setting up a cljs development environment is to use Figwheel. For instance see here. - Chris Murphy

1 Answers

1
votes

Use Figwheel https://github.com/bhauman/lein-figwheel

It is easy to set up and does exactly what you want (errors/warnings will be shown in both a discreet popover and the console of your browser). Figwheel reloads your code when you save your file, which I find to be a far better workflow than using a REPL. I made a short video which shows this style of workflow: https://www.youtube.com/watch?v=pIiOgTwjbes. The video shows quite a few different debugging scenarios, and how to make sense of them. If there is anything not covered, please let me know!