Fork me on GitHub

@mfikes I couldn't easily make a simple repro, but I had a local called goog and was just using it as the first arg to a protocol method; the code was broken till I renamed it to googx the error said that goog was undefined


for anyone interested….

👍 4

Hello everyone! Do anyone know how to enable an error stack trace from the clojurescript, not from the JS? Now I receive at the chrome console messages like this:

Uncaught TypeError: Cannot read property 'getHostNode' of null 
Further a long stack trace from JS
at Object.getHostNode (
    at ReactCompositeComponentWrapper.getHostNode (
    at Object.getHostNode (
    at Object.updateChildren (
    at ReactDOMComponent._reconcilerUpdateChildren (
    at ReactDOMComponent._updateChildren (


Or why don`t figwheel write an error trace from very clojurescript files sometime?


I don't understand npm upgrading. I run npm i npm and it says + [email protected], but then I run npm -v and it says 5.6.0.


@roklenarcic npm i -g npm otherwise you are installing in the current directory.


Do :closure-defines always need to be defined in the goog namespace?


I want to create two builds based on a compile time variable


Blocks of my code should be exlcuded from one build, based on the value of this variable.


I would like to make a library wrapping a js-lib. I see that did this by copying the js-source into its own source. Is there a smooth way to do this using npm-deps, so leiningen takes care of including the js dependency in the jar? The problem here is that the a library should be distributed as source code, and therefore won't have the cljsbuild step that would include the npm dep...


{:closure-defines {bbb/admin? true}} and I'm able to refer to bbb/admin? in code. However, the compiler gives warnings like WARNING: WARNING - unknown @define variable bbb.admin_QMARK_ and no matter where I put ^boolean type hints in the code, I can't seem to get rid of (if bbb/admin?) blocks from the build


Worked it out, wasn't quite getting it to start with. Need to use (goog-define ^boolean admin? false) to set the default value in the namespace, and then override with {:closure-defines {my.namespace/admin? true}} in project.clj


hi i have a strange issue with dependency order. is there a way to ensure the order of load for included dependencies which do not have themselves specified a "requires" on each other. I am using CLJSJS package for adding MaterialUI and another package which requires js/MaterailUI to be present, but doesn't mandate in its specification. sometime it works but sometime it doesn't. If i include the js file directly using <script> in index.html, then it works fine. However, if I include it as leiningen dependency, then sometime I run into trouble when they are loaded in another order. Is it possible to force the order of load?


@pradyumna If you set it as a Leiningen dependency, then that puts it on the classpath, but then if you have no other references to it (say via :require or :foreign-libs) then presumably the only effect is that may add a deps.cljs on to the classpath. Something else should probably explicitly set a dependency on it so that the compiler can establish an order for it in the topological sort.


thanks @mfikes i am not aware of deps.cljs, could you please point me to some reference on how to use it


This provides a mechanism by which dependency JARs can themselves specify upstream foreign dependencies.


My hunch is that, by including a CLJSJS JAR that specifies MaterialUI on your classpath, you get this dependency set up as a foreign lib, but nothing is explicitly consuming that foreign lib.


@mfikes yes, that is the case. however both the libraries are third party jars, and i would prefer not to modify the jars themselves, rather do something on top of it


my assumption was that in ns form the order of :require would ensure the order of load, but apparaently that's not happening


Yeah, if you look at the section right above that one, it shows how to use :require to consume a foreign lib.


does this mean that, i should download the js files and include them in project folder, not use the dependency spec in lein project


No. It sounds like you have things set up correctly. Perhaps enabling the :verbose compiler option would shed some light on what is occuring.


ok, i'll check that


Hey guys! I’m having some issues in where chrome tells me my compiled cljs in my browser extension isn’t utf8, which it clearly is -


anyone an idea why this is happening? I tried specifying utf8 in cljsbuild directly but same problem


looks like turning on advanced compilation is fixing the issue, but now a lot of other things aren’t working 😄


@dvcrn I ran into the same issue building a chrome extension


add :closure-output-charset "us-ascii" to your :compiler options


ohhh let me try this


@pesterhazy it worked ❤️


thanks a ton. I would have hunted for the issue for hours to come


you're welcome


hey just wondering, how does elm stack up against clojurescript? anyone knows ?


I've only played with Elm a little bit. Elm is easier to get started and more friendly to incoming devs and has error handling that tells you how to fix mistakes. JavaScript interop is through message passing. You tell Elm what data you want from a JavaScript library and then pass that data back to Elm (with types of course) The Arrays are ClojureScript Vector's and the dictionary is a Red Black Tree (no hash maps in Elm). There's no Type Class / Protocol abstraction so you can repeat yourself many times for bigger abstractions. The production builds use JavaScript tooling instead of Closure Compiler so the builds tend to be bigger.


I prefer ClojureScript for it's better datatypes, protocols, emphasis on data of code, having Google Closure Library as a JavaScript standard library, and JavaScript interop. I wish ClojureScript had the friendliness of Elm's errors and using the Google Closure Compiler can get quite frustrating to use with JavaScript libraries and get advanced compilation working.


@spinningtopsofdoom that's a great overview, thanks!


@shulc_ I did only a tiny bit Elm, but to complement @spinningtopsofdoom I would like to add two differences. While clojurescript is very stable, elm has breaking changes more often, but to do an upgrade it's well documented. Because if the types you often need more code, I read some comparison some while ago and Elm had by for the most loc of the tested frameworks, and about 10 times more as clojurescript.


Is there a way to step debug clojurescript code? preferably using cursive?


@neupsh I believe it is possible with but I have never tried


@lee.justin.m thanks, I did try dirac, works great most of the time, but for some reason sometimes it skips the breakpoint and I cannot see the values when I want 😞 (i think the code does not sync up sometimes)


I was wondering if I could just run a function in intellij's repl and have it hit the breakpoint 🙂 it would be so awesome


it does work for clojure but not for clojurescript


@neupsh I think you can place manual breakpoint via js-debugger, this way you can work around DevTools confusion about generated javascript code:


you can also “join” Cursive’s REPL with Dirac REPL, this way you can stay in your IDE while issuing commands to Dirac REPL