Fork me on GitHub

Hey everyone, as someone newer to ClojureScript, what is the recommended framework to get started with after learning the language basics?


Hi 👋:skin-tone-5: Josh! I would recommend checking out the learning curve is not as steep as some of the other CLJS front-end frameworks and its pretty expressive and functional (it uses react under the hood too)


there is also a pretty good list on


Hello! I would recommend both as well and maybe re-frame


Has anyone had any luck getting code splitting modules to work under any optimization level with 1.9.854 and lein cljsbuild? I keep getting an assertion error when I try to load a module: ” Assert failed: Module does not exist”, where the module name in that message is nil (the message is supposed to say “Assert failed: Module :x does not exist”, where :x is the thing you tried to load; however, I’m calling load with a keyword and a callback. When I trace it in the browser the module info has the module, but sure enough the module name is turning nil somewhere along the way. The js is a little hard to read, so I’m still not sure where it is going wrong, but seems like a bug to me.


@tony.kay I have been working with modules recently, I have not come across that specific issue. If you could make a minimal case available that reproduces the issue I could take a look?


Hey channel... I am having trouble with some old code in the Clutch couchdb client that uses cljs/closure. It's based on an ancient version of the ClojureScript compiler, and breaks when I try and use it with something modern (in this case, 1.9.854). In particular, if I try and do something like this, which used to be legal:

(closure/build '[(ns foo) (defn str-dentity [y] (str y))] {:optimizations :simple :main 'foo/str-dentity})
I get the error
java.lang.AssertionError: Assert failed: No file for namespace foo/str-dentity exists
I get the feeling (though I am guessing) that the single-file logic (triggered by :optimizations and :main) expects me not to be trying to compile a quoted code literal. Is that even supported nowadays?


Thanks - that's what led me here. I guess I'm wondering if the feature I'm trying to use is deliberately no longer supported, accidentally borked by the single-file logic, or supported in some other fashion in these modern times.


the feature being a quoted literal?


Quoted literals still work - my specific problem appears to be exporting one as a :main.


isn't the error because it can't find a corresponding file for the 'foo' namespace?


Right. And the namespace is created in the input list. Which is to say, it doesn't have a file.


so the error would be expected, no?


unless im missing something


i am not aware of how it used to work


😉 The point being that this used to work - when Clutch was written, you could do exactly this trick. Now it appears you cannot, and I'm trying to figure out a) whether that is deliberate, and maybe b) if there's a different way to achieve the same end.


right, sorry i couldn't be of assistance.


i can't see anything in the changelog about it


The wider context is that Clutch uses the feature to generate JS views for execution by the CouchDB server - and they have to be something you can send encoded as part of a POST request, expressed as a single JS callable.


No worries @U61HA86AG , thanks for looking though. The quest continues...


hey guys is there a way to make a function repeat at a set number of seconds


Maybe just define a setTimeout function that calls your function once, and then re-queues itself with another setTimeout?


like each second


try (js/setInterval (func-name) 100)


i know about that but i need a live feed of the state in my repetition


and using set inverval it gets locked on the first state that is gets


@joelgluth I read through that thread - it is supported but you are trying to combine it with :main


far as I can tell :main didn’t exist back then and what you want to do was never supported


also your :main doesn’t even match existing usage


:main must be a namespace that corresponds to a file on the classpath


I would just remove that, and your build should work


(it seems you think :main corresponds to Clojure’s idea of :main - this is not true and never has been)


Cheers @dnolen ! Some more context is that this is not my code; I'm wanting to use the Clutch couch client and trying to understand why it won't work with modern CLJS. It seems like Clutch's technique is a bit of a hack that maybe worked for a small window of time.


we own compiler options


if we take a name, other tooling must deal with it


Reading their code, I think they were using :main as a way to avoid the Closure compiler optimizing away a containing callable, which CouchDB wants.


This is not vital to my life, just interesting. I'll keep digging around and see if I can make it do that a different way.


(It turns out that that part of Clutch was written for cljs 0.0-1450, and works up until cljs 1.7.58 inclusive.)


hey folks, reasking again from last night 😄 - what is the proper way to include scoped packages with :npm-deps?


if i provide it as a symbol, such as :@namespace/pkg it ends up just looking for pkg on npm


you use a string - {:npm-deps {"@scope/pkg" "1.0.0"}}


sweet thank you


no problemo


curious - how do i then reference it in my ns requires?


also a string


someone encountered this unwanted space when generating extern with the genereate-extern tool

Extern for material-ui
 Generated by 
var material - ui = {
  "AppBar": { .... etc...
Or would it be an indicator that this extern is not the right symbol.


@hlolli The var name is arbitrary, so the tool should probably munge (to perhaps material_ui). Otherwise it is being treated as a JavaScript minus operation.


yes, realized that minus sign is not leagal symbol in js.

define("material-ui",["react","react-dom","react-transition-group/TransitionGroup"],t):"object"==typeof exports?exports["material-ui"]
this probably causes the tool to find that symbol. This is from the pre-release material-ui 1.0.


not going to spend more time on this, I won't compile advanced for now 🙂


is there a way to specify a closure-compiler version to use with clojurescript? specifically trying to use the develop build which includes this fix


Further to my question about closure/build above, I've figured out what is going on (or was), but the explanation is kind of wordy and I have some other detailed questions about compilation as a result. I don't want to clog up the channel with my personal rabbit-hole if it's not appropriate... is there somewhere better I should take this?


@symfrog Thanks. It’s nice to know I’m not hitting a build tool issue 🙂


Not entirely-unrelated question: If I want to provide a quoted literal to closure/build (say, '[(fn [x] (str x))]) and get back something (doesn't matter how big) whose value when evaluated was that function, without loading external JS files, is that possible? I'm open to adding boilerplate either to the form or to the compiled JS if it will help.


I'm having trouble figuring out how to remove a value from a nested set in an atom. I am able to conj the value into the set but I don't know how to remove that value. Example below is my failed attempt to use dissoc

(let [post (atom {:collaborators #{}})]
  (if (= true some-value)
    (swap! post update-in [:collaborators] conj "thing")
    (swap! post update-in [:collaborators] dissoc "thing")))
What is the correct way to do this?


@xanderseren You should be able to use disj ( instead of dissoc


@symfrog perfect! that worked 🙂


@shzhng I would imagine you could get away with specifying your own version of this dep: especially if you are using a compatible version of ClojureScript


@joelgluth Are you saying that you’d like standalone JavaScript? In other words (fn [x] (str x)) involves a call to cljs.core/str, while (fn [x] (inc x)) ends up emitting JavaScript that looks like (function(x) { return x + 1;})


I’ve added "@google-cloud/logging" "1.0.5" to npm-deps, but require-ing ["@google-cloud/logging" :as Logging] does not work with the following error:

Caused by: clojure.lang.ExceptionInfo: No such namespace: @google-cloud/logging, could not locate _CIRCA_google_cloud_SLASH_logging.cljs, _CIRCA_google_cloud_SLASH_logging.cljc, or JavaScript source providing "@google-cloud/logging" in file /Users/lvh/Latacora/Code/cspshovel/src/cspshovel/gcp.cljs {:tag :cljs/analysis-error}
doing require("@google-cloud/logging"); from a node repl in that dir works fine. Is it because of the at sign or something?


@lvh are you consuming this from node or browser?


there might be 2 bugs here


give me some more time