This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-27
Channels
- # aws-lambda (2)
- # babashka (22)
- # beginners (188)
- # calva (24)
- # cider (16)
- # clj-kondo (2)
- # cljfx (5)
- # clojars (15)
- # clojure (146)
- # clojure-czech (1)
- # clojure-europe (10)
- # clojure-france (3)
- # clojure-provo (1)
- # clojure-sweden (8)
- # clojure-uk (6)
- # clojurescript (28)
- # conjure (3)
- # core-logic (1)
- # cursive (13)
- # datahike (2)
- # datomic (18)
- # defnpodcast (2)
- # figwheel-main (2)
- # fulcro (1)
- # honeysql (4)
- # hoplon (21)
- # jobs (3)
- # jobs-rus (1)
- # kaocha (5)
- # off-topic (49)
- # pathom (86)
- # reagent (4)
- # remote-jobs (2)
- # ring (4)
- # schema (1)
- # shadow-cljs (40)
- # spacemacs (12)
- # sql (20)
- # startup-in-a-month (30)
- # xtdb (19)
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…you can look at how that cljsjs package is created to find out what require that would be
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:
clojsandbox/app/core.cljs
klipse/run/plugin/plugin.cljs
klipse/plugin.cljs
klipse/klipse_editors.cljs
klipse/ui/editors/common.cljs
klipse/ui/editors/editor.cljs
cljsjs/codemirror/addon/edit/matchbrackets.cljs
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()
? -> https://www.cssscript.com/pure-javascript-qr-code-generator-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
(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
: https://github.com/neocotic/qrious/blob/master/dist/qrious.js
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.
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.@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 https://github.com/neocotic/qrious/blob/master/dist/qrious.js#L1923
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
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/Date.now)}] 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 []
@root-version
(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)
(start))
@jaime.sangcap you can use the helper I created https://github.com/thheller/reagent-react-native/blob/master/src/main/test/app.cljs#L36
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
@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
Looks like this is the tap> workflow you've mentioned? https://clojureverse.org/t/introducing-shadow-cljs-inspect/5012
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:
just open the ui at http://localhost:9630/inspect-latest and tap something in the REPL