4 ms·
Debugging advanced compiled Closure in ClojureScript is actually pretty straightforward if you know which knobs to turn - :pseudo-names true, :pretty-print true
by swannodette 12y ago
Debugging advanced compiled Closure in ClojureScript is actually pretty straightforward if you know which knobs to turn - :pseudo-names true, :pretty-print true build options are pretty much all you need.
I'm somewhat skeptical about a set! being eliminated unless you were setting a property of an object from a random JavaScript library you haven't provided an extern for. The above compiler settings would have showed this immediately.
- city41 12y agoI did not know about :pseudo-names, that looks to be quite helpful. Thanks. This is the method I was dealing with: https://github.com/city41/bookends/blob/master/site/src/cljs/demo/knex.cljs#L6 https://github.com/city41/bookends/blob/master/site/src/cljs... In that let expression I'm digging my way down into a native JS object to monkey patch it. The equivalent (set! (.. knex -client -Runner -prototype -debug) ...) was being completely removed as far as I can tell. Same with an equivalent aset. That channel no longer got set up and my app stopped working. If I simply put that method back to set!, then it breaks again, very reproducible. When I added in a (.log js/console "hello") to the method, I could see that console log inlined where the method call was, but no other remnant of the method could be found. I will play with :pretty-print and look into creating a small repro of what I'm seeing. But if I don't succeed with a smaller repro, then at the very least this app is already quite small. EDIT: here is a little gist showing the difference I'm seeing if anyone is curious: https://gist.github.com/city41/12099b91e0fbb526b0dc https://gist.github.com/city41/12099b91e0fbb526b0dc
- swannodette 12y agoYes this code is exactly the problem I described above - you are not supplying the required Closure externs file for Knex.
- city41 12y agoOk, thanks for the help. I still can't seem to give it an externs file that makes the compiler happy. But I'll look into it on my own.