Fork me on GitHub
Griffin Smith02:10:17

Hey all - running into an issue with npm-deps in cljs - everything works fine until I add some npm-deps to my project, at which point reagent's local variable that's supposed to be pointing to react-dom becomes undefined. This is using figwheel

Griffin Smith02:10:12

hmm that's strange, I removed :npm-deps from the compiler options and the problem is still here... maybe this is a compiler cache issue

Griffin Smith02:10:42

well this is strange... I nuked the target directory entirely and the problem is still here

Griffin Smith02:10:55

so much state 😭

Griffin Smith02:10:39

what on earth... I removed node_modules too and it's still happening

Griffin Smith03:10:59

Now I'm getting ReferenceError: $jscomp is not defined

Griffin Smith03:10:05

this is so brittle...

Griffin Smith03:10:13

now every time I build I get Unable to resolve symbol: import in this context 1993 without a filename

Griffin Smith03:10:41

finally got everything to work by completely busting the cache and removing node_modules, but now every time I add it back I get the same error... it seems figwheel+reagent+react-dom really don't work well together at all, which is kind of baffling to me


I’d take it to #figwheel or #figwheel-main , then 🙂 And alternatively, you could try using shadow-cljs, it seems to be pretty good for npm deps. I believe npm deps are newer to figwheel than to shadow-cljs, but I also think that Bruce is pretty active and motivated in fixing whatever npm deps problem you might be having with figwheel.

Rico Meinl09:10:16

Hey everyone! Cljs beginner here. Does anyone have a solid and simple setup for clojurescript to create and export to Javascript code which I can then host as a gist

Day Bobby09:10:20

clojurescript exports to unreadable javascript code so I don't think you can use it for a gist

Day Bobby09:10:36

but I'm also a beginner maybe someone else can give you a better answer


If you don’t use any optimization, you can see the correlation if you squint a bit, but it won’t really be useful. Why do you want a gist of the generated code?

Rico Meinl09:10:19

Not necessarily a gist. Just a js file that I can load via <script>. It's for a roamresearch extension


If your CLJS snippets don't require any dependencies, then you can use


Ah, then I'd just follow the shadow-cljs user's guide. :) You should end up with a scaffolding that has just 2-3 files with a few lines in them.

Day Bobby09:10:13

anybody using clojurescript for backend node development? If so, what are you using to interface with sql databases?


if you're doing backend development, why not go straight for clojure instead of clojurescript? If you're still using clojurescript for backend (for whatever reason), maybe try using what you're already used to in JS but interop with it in CLJS, should get you up and running quickly

Day Bobby09:10:55

It's a backend for my web crawler. I plan to use puppeteer js for the scraping part because puppeteer doesn't have a java client, now I just need a way to persist the scraped data. In Node land I use typeorm for this kind of stuff buts its tied heavily to typescript, guess I will try to find a light alternative (something more like next.jdbc for node). Thank you!


There's Etaoin to remote-control browsers from Clojure, I'm using it in production here for a web crawler/scraper.

Day Bobby09:10:44

Wow I didn't know about it. Thank you! May I ask have you used Puppeteer before, and if so is there any major difference between the two?


I've used both, for scraping as well 🙂 Etaoin is nice in that it's still using webdriver protocol, so easier to integrate everywhere. Mostly it's just the API itself that differ, as Etaoin is made in traditional clojure fashion (works well with repl workflow) while puppeteer as a traditional JS API (wants to evaluate and rerun the entire file on change). Of course this can be worked around, but no need when a nice API already exists. When using Etaoin for testing I also managed to get all of Chrome, Firefox and Safari to work it and I think puppeteer only works with chrome and firefox (3rd party)


(although, haven't used puppeteer from clojurescript, only vanilla js)

Day Bobby10:10:04

This is super useful, thank you guys.

❤️ 6

I want to apply some function (x,y) to each (x,y) value on a 500x500 grid, in order to draw on a <canvas> with decent FPS. Should I consider more efficient storage for the numbers than Clojure vectors? In Clojure, I'd reach for


I would write the simplest implementation that comes to mind, measure its performance, and tweak it till it's sufficient. Hard to say anything in advance, especially without knowing the target PCs' specs and the function.

👍 3

^. My backup plan would be a plain javascript array with length 500*500, then just calculate the index based on x and y.

👍 3

Thanks for the advice! I like the simple sound of a plain 1d javascript array. Reminds me of, which uses a 1d java array to store images. That was a pleasure to work with.


What kind of functions are you appointing over the data? There are various WebGL backed matrix implementations for JavaScript, even if you’re not using WebGL for rendering.

👍 3

Plain math, at least to begin with. Coordinate transformations, colors

Milan Munzar19:10:09

Hello, it seems that ClojureScript doesn't support BigInt literal N (at least on node). I have found a Jira issue, but it is closed. Is it a known issue? Construction via js/BigInt, works as expected. But operator ** doesn't seem to work. Does anyone manage to work it out? Thx! :)

Justin Chandler21:10:16

Hey, everyone! Got a small question that's more like a general web dev question rather than specifically ClojureScript. I've written a small app in ClojureScript using a 3D WebGL library that displays a 3D model of a TV and streams an MP4 onto the screen. I can't really figure out what determines whether a link is compatible though. For https://live.gcloud mp4's it streams fine, but for others I can go to the url and download the mp4 but not stream it from my web app. At first I thought it was just that they only allowed downloads, but apparently another javascript player called JWPlayer grabs the same url that only hosts downloads and streams it from the website just fine. What's the difference?

Justin Chandler21:10:34

Ah never mind, it's not a problem with implementation, it's just CORS authentication. Doesn't even matter for the final web app.

Trung Dinh23:10:27

hi , I’m trying to replicate react-window example ( with no luck, can someone please point me how should it be done? my take was

(defn row [index, style]
  [:div {:style style
         :background-color (when (= 1 (mod index 2)) "#F8F8F0")}
   (str "Row" index)])

(defn example []
  [:> FixedSizeList {:height 150
                     :item-count 1000
                     :item-size 35
                     :width 300
                     :border "1px solid black"}

(defn app []


According to that example, row is a function that has to return an element. By itself, row is not a component. Try replacing [row] with just row and wrapping the whole body of the row function in (reagent.core/as-element ...).

Trung Dinh00:10:04

thanks @U2FRKM4TW, I did as suggested + switch to material ui, it works but style seems not to work properly,

(defn row [index style]
   [:> ListItem {:button true
                 :style style
                 :key index}
    [:> ListItemText {:primary "test"}]]))

(defn example []
  [:> FixedSizeList {:height 500
                     :item-count 200
                     :item-size 200
                     :width 300
                     :border "1px solid black"}

(defn iam-app []
   [:div [example]]])
The example I followed was , not sure how can I pass in data to row if replacing [row] with row? and how do we do this in cljs/hiccup? Thanks
renderRow.propTypes = {
  index: PropTypes.number.isRequired,
  style: PropTypes.object.isRequired,

Trung Dinh02:10:07

all good, I need to destructure the params passed to row properly, thanks