Fork me on GitHub

has anyone managed to get Klipse working on Shadow-CLJS? I’m having one heck of a time trying to get it to build.

[:app] Build failure:
The required namespace "cljsjs.codemirror.addon.edit.matchbrackets" is not available, it was required by "klipse/ui/editors/editor.cljs".
I have already added codemirror via npm install codemirror, so I’m stuck…


Thanks for your reply @thheller. I’ve added the file src/main/cljsjs/codemirror.cljs file to my project, with this code inside:

(ns cljsjs.codemirror
  (:require ["codemirror" :as cm]))

(js/goog.exportSymbol "CodeMirror" cm)
However, I still get the build failure:
The required namespace "cljsjs.codemirror.addon.edit.matchbrackets" is not available, it was required by "klipse/ui/editors/editor.cljs".
I must be doing something silly — I just can’t work out what it is…


well you added cljsjs.codemirror not cljsjs.codemirror.addon.edit.matchbrackets


thats a different ns and different require


you can look at how that cljsjs package is created to find out what require that would be


may just be "codemirror/addon/edit/matchbrackets" but I'm not sure


Sorry about this, but I am still confused. I have also added the file src/main/cljsjs/codemirror/addon/edit/matchbrackets.cljs file to my project:

(ns cljsjs.codemirror.addon.edit.matchbrackets
  (:require ["codemirror.addon.edit.matchbrackets" :as cmaem]))

(js/goog.exportSymbol "CodeMirrorAddonEditMatchbrackets" cmaem)
Now I get the build error:
[:app] Build failure:
The required JS dependency "codemirror.addon.edit.matchbrackets" is not available, it was required by "cljsjs/codemirror/addon/edit/matchbrackets.cljs".

Dependency Trace:


please check what I said in my last message 😛


the require string does not always match the cljsjs name exaclty


so at the very least it requires / instead of .. you can find the correct path by going into node_modules/codemirror and finding the correct folder or matching .js file for the above


so either node_modules/codemirror/addon/edit/matchbrackets.js or node_modules/codemirror/addon/edit/matchbrackets as a folder


Doh! Silly mistake. I think I need to get some rest, thanks for your patience @thheller


Hello. I have included the npm module qrious into my package.json. How do I require it in my namespace and call the constructor new QRious()? -> I have tried ["qrious" :as qrious] but js/QRious is not defined. qrious seams to be a function, but calling it throws Cannot read property 'bind' of undefined .


@witek in general you NEVER use js/ for anything that you imported via require in the ns. you use the :as name directly


so probably just (qrious. ...)


(qrious. ...) throws Uncaught Error: Invalid option: __reactInternalInstance$uiqex7uo9w at Nevis.extend.exists._set (qrious.js:1924). When using qrious in Vanilla JS, I have to call the QRious() constructor, which is defined globally when including the qrious.js via <script>. Don't I have to mention this QRious constructor somehow? Perhaps you have a hint for me after having a look at qrious.js:

Michaël Salihi14:01:49

Hi @witek, did you tried to use qrious in vanilla JS with require like const qrious = require('qrious')? It works? The doc does not mention this method.

Michaël Salihi14:01:09

If yes so as mentionned thheller, require the lib in your CLJS namespace like that:

(ns your-namepace
  (:require ["qrious" :as qrious]))
Then you could interop: (def qr (qrious. #js {:element (.getElementById js/document "qr"), :value "Custom value"})) > Don't I have to mention this QRious constructor somehow? Note the dot after QRious, this is a sugar syntax for construct new Object...equivalent to (def qr (new qrious #js {:element (.getElementById js/document "qr"), :value "Custom value"})) Refresh your page and it should works.

👍 3

@witek without a full code snippet for what you are doing we cannot help much. the constructor appears to be called properly, just with an option it didn't expect, since it seems to get to this part


trying to use rechart, but it’s failing to build with the following error. any ideas? > Closure compilation failed with 2 errors > --- node_modules/d3-array/dist/d3-array.js:271 > This code cannot be converted from ES6. extending native class: Map > --- node_modules/d3-array/dist/d3-array.js:291 > This code cannot be converted from ES6. extending native class: Set


@benny you need to up your :compiler-options {:output-feature-set :es6} if there is code that can't be transpiled


that did it! thanks @thheller


Hi all, how to do the hot-reload trick in react-native, similar to below example with react-dom...

(defn ^:dev/after-load start []
  (reagent/render [ui {:x (js/}] dom-root)) 
Here is the entry point for react-native, it accepts a function that returns react component
(react-native/AppRegistry.registerComponent "myApp" #(reagent/reactify-component root))
EDIT: I've tried below which I've found thru googling but does not work. Though I don't really understand the theory behind to be honest 😅
(def root-version (atom 0))
(defn reloadable-root []
  (r/reactify-component root))

(defn start []
  (rn/AppRegistry.registerComponent "myApp" reloadable-root))

(defn ^:dev/after-load after-load []
  (js/console.log "after load...")
  (swap! root-version inc)


or copy what that does if you want to roll your own


I can tell that for you the issue is that your are deref'ing the @root-version outside of a scope where reagent looks for it

👍 3

@thheller Awesome! ❤️ Thanks for the link. I will try that trick. Btw, IIRC you also use cursive and intellij? How do you manage to switch between repl? One thing I noticed is that for running (shadow.cljs.devtools.api/watch-compile-all!), you need to be in the CLJ repl. But for evaluating cljs, you need to be in the CLJS repl. How do you manage to compile/reload while making changes?


I never use (shadow.cljs.devtools.api/watch-compile-all!) so I rarely have a reason to be in a CLJS repl when working on CLJS


I'd be interested to know about your workflow when working with web apps. Would you mind sharing? 😄 Do you just enable the autobuild when watching file changes?


yes, just the regular shadow-cljs watch app. or rather nowadays just shadow-cljs server and start the watch from the UI


heavily using tap> with Inspect but actually very little REPL for CLJS


Thanks for sharing. Will try experiment with that workflow


Looks like this is the tap> workflow you've mentioned? Not sure what is the difference with tap> and sending forms to repl. But somehow I'm excited to acquire new super powers!! :star-struck:


tap sends it to the UI. the UI isn't otherwise integrated into the REPL for now.


just open the ui at http://localhost:9630/inspect-latest and tap something in the REPL


(assuming you use a somewhat recent version)


When I select view as edn , it shows as the var


I already changed my keymap from send to repl to (tap> ~selected) repl command 😉


when I do some CLJ stuff I just open a second connection