Fork me on GitHub
Binita Bharati08:12:01

Hello folks, I am trying to compile a production release with this command : clojure --main cljs.main -co '{:closure-defines {"clojure.browser.repl.HOST" ""} :optimizations "advanced"}' --compile cljs-sample-proj.core I am getting this error : Unexpected error compiling at (REPL:1). Could not write JavaScript nil I also tried clojure --main cljs.main -co '{:closure-defines {"clojure.browser.repl.HOST" ""}}' -O advanced --compile cljs-sample-proj.core and clojure --main cljs.main -O advanced -co '{:closure-defines {"clojure.browser.repl.HOST" ""}}' --compile cljs-sample-proj.core . Both of these gives the below error : Dec 06, 2019 8:51:05 AM println WARNING: WARNING - unknown @define variable clojure.browser.repl.HOST Dec 06, 2019 8:51:05 AM printSummary WARNING: 0 error(s), 1 warning(s) How do I get this to work please ? Thanks!


Try :advanced instead of "advanced".


Also, maybe fore future reference and especially if you want to use NPM libraries, consider using shadow-cljs - it does many sensible things for you.


Regarding unknown @define variable - that's because you're compiling the app and not running a REPL on it. The variable is defined within the REPL source which is not used during a simple compilation.


So, to just compile the app, you should omit this particular entry in :closure-defines.

Binita Bharati08:12:55

@U2FRKM4TW - Thanks! Actually, my intention is to build a production release and then execute a clojure -m cljs.main --serve . So, without :closure-defines the server starts at default localhost:9000, whereas I want it to start at my required network IP. Actually, am just trying to follow the clojurescript guide to get a feel of the things. Will definitely use shadow-cljs as I proceed further


clojure.browser.repl.HOST is for REPL only. It doesn't affect the way you serve your files in the production. Try --serve host:port , as the help available at clj --main cljs.main -h suggests.

Binita Bharati09:12:23

Thank you ! It works.

👍 4
Mehdi H.12:12:01

Hi all, Has anyone ever been able to use cljsjs/delaunator? I have tried multiple combinations of (js/Delaunator.from. [[1 2] [2 3] [1 5] [2 4]]) with different point formats (including the one in the example (<>), which is [[1, 2], [2, 3], [1, 5], [2, 4]]. It seems from is not to be called as prototype values as described here (<>) because of how the externs are defined here (<>). The output is : #object[Error Error: No Delaunay triangulation exists for this input.], although the points are not aligned... What am I doing wrong? Thanks!!

Mehdi H.12:12:25

Using (js/Delaunator.from. or (js/Delaunator/from without '.' doesn't even change the error message...


Have you tried wrapping your arrays in clj->js?

Mehdi H.12:12:39

holy hell you're works. Well I am not getting any error. Any idea how to access hashedges from there? Cause the externs contain functions but for instance I can't even find in the original index.js the _hashEdge one


As soon as I see the words "externs" or "cljsjs", I immediately go to shadow-cljs for the help. 🙂 And then I can actually start working instead of yak shaving.


So that's the only advice I can give - use NPM libraries as is and use shadow-cljs.

Mehdi H.12:12:14

haha ok I will have a look! Thanks a lot for the help!!


No problem.

Mehdi H.12:12:40

turned out halfedges are properties of the js object, so (.-halfedges Object) worked 🙂 thanks again!!

👍 4

Hi, Do clojure and clojurescript code are interchangeable? I mean, if i write a program in clojure (that only use the core language features), can i simply change the dependency on clojure by clojurscript an it will work?


roughly @U2KGTH1EG - there are often small differences to take account of


figwheel channels are dead so guess I'll ask here too


i recently updated an old project to figwheel 0.5.19, which seems to have caused it to break somehow. files aren't correctly reloaded in the browser, and i'm presented with Figwheel: error loading filemessage in the console


i tried increasing :time-in-msoption on the server to eliminate a basic timing issue, this looks like a browser issue however


when I make a change, every file that change touches seems to time out independently when attempting to reload in the browser

Mehdi H.15:12:22

Hi all, anyone knows how to get the value at index n of Uint32Array? I can't get the syntax right, and can't find any helpful function or property in here :

Mehdi H.15:12:23

I tried (get-uint32 array index) but it doesn't work

Mehdi H.16:12:00

oh wow...thank you so much rakyi!!! how could I have found this out?

Mehdi H.16:12:04

I tried all sorts of get...but not this one


yeah, it is only in Clojure Cheatsheet

Mehdi H.16:12:22

I'll remember to check both! Thanks again!!

Ben Hammond16:12:30

I am trying to use js/MaterialUIStyles.makeStyles with react/rum/citrus It seems to be absurdly fiddly because • ONLY works as a React hook • rum/defc will ONLY give me a plain-function component (suitable for hooks) if I avoid any kind of mixin complexity Is there a known way to make this less awkward?


would like a non-breaking space in a string. should be "\xa0" and this works in the javascript console. However, clojurescript is just a clojure program and "\xa0" and this is an unsupported escape character. A workaround is (char 160) but wondering if there was a more elegant solution?


not much more elegant lol


seems to be an underscore


oh actually you can put it in a string


cljs.user=> "foo \u00a0 "
"foo   "


awesome. thanks!