This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-27
Channels
- # announcements (8)
- # architecture (3)
- # aws (18)
- # beginners (96)
- # bristol-clojurians (3)
- # calva (15)
- # cider (7)
- # clj-kondo (8)
- # clojure (135)
- # clojure-denmark (1)
- # clojure-dev (14)
- # clojure-europe (37)
- # clojure-italy (9)
- # clojure-nl (14)
- # clojure-sanfrancisco (1)
- # clojure-spec (1)
- # clojure-uk (54)
- # clojurescript (27)
- # core-async (243)
- # cursive (28)
- # data-science (6)
- # datomic (33)
- # fulcro (25)
- # graalvm (24)
- # hoplon (2)
- # instaparse (12)
- # jackdaw (1)
- # java (21)
- # juxt (12)
- # meander (10)
- # nyc (4)
- # off-topic (6)
- # om (3)
- # pathom (17)
- # perun (1)
- # re-frame (29)
- # reitit (4)
- # rum (3)
- # shadow-cljs (119)
- # spacemacs (31)
- # xtdb (14)
The shadow users guide specifies that to use shadow-cljs with deps.edn you can add an alias with a different main. Using this from CIDER presents a problem as CIDER needs its own main to get nrepl started up and the middleware injected. It seems somehow we need to get the shadow server up and running. I tried (shadow.cljs.devtools.server/start!)
and this is almost there. The problem is that this doesn't use the nrepl middleware so i just need to figure out how to get that up and going. Does anyone know of a good way to support this?
@dpsutton you need start!
and the middleware. see https://shadow-cljs.github.io/docs/UsersGuide.html#_embedded_nrepl_server
How to I retrieve __dirname
from a cljs repl attached to a node-script (compiled with shadow)?
actually it might not exist? its a special binding that only exists when loading files. so if it exists it likely is from the file that "loaded" the REPL code
that is exactly identical to js/__dirname
. literally no difference in the emitted code
i confirm "dirname is not defined" at a cljs-repl and that it works in a :node-script target in a cljs file.
__dirname
is inherently tied to the current file ... REPL has no file so you probably shouldn't use it from the REPL 😛
ah ... 🙂 I guess what I meant was actually if I could use it from a node-script compiled with shadow. Not sure why I mentioned "repl" 😉 It seems Lumo handles it in a special way, so i thought maybe shadow also does? Already tried js/__dirname
and it doesn't work.
Edit: better link
https://github.com/anmonteiro/lumo/commit/658732fb2b934569507db9cc9a845aea07918f0c
I have some resources that I want to load - so I'd use __dirname
for their base-path. Is there a better option?
hey! I'm trying to get an app to compile with shadow-cljs using Boot, via boot-shadow (https://github.com/degree9/boot-shadow)
Compiling ClojureScript using shadow-cljs: release
[:web] Compiling ...
The required namespace "shadow.js" is not available, it was required by "braintree-2.26.0.min.js".
the braintree thing is my native dependency, but it doesn't refer to shadow.js
in any way
the app builds fine with plain shadow-cljs
, but I need to use Boot for now because of existing infrastructure
@dj942 I suspect its a classpath issue. shadow/js.js
should be on the classpath. boot does a lot of dynamic classpath magic so its easy to miss stuff
I just noticed that boot-shadow was using shadow-cljs 2.8.14; I've added an exclusion and manually specified 2.8.83, seems to be working now
Could you open a PR for this issue if updating fixes it, also where did you pin the new shadow version in your project?
I've pinned it in (set-env! :dependencies ...)
in build.boot:
[degree9/boot-shadow "2.8.14-0" :scope "test" :exclusions [thheller/shadow-cljs]]
[thheller/shadow-cljs "2.8.83"]
another question: with shadow-cljs, are React externs necessary to produce working release builds of reagent apps?
fair warning: you need manual externs for datascript
:compiler-options {:infer-externs :auto
:externs ["datascript/externs.js"]}
I’m trying to figure out how to require and use a react-modal (https://github.com/reactjs/react-modal) Modal
component in my reagent/shadow-cljs project…
I’ve added react-modal
to package.json and re run yarn
and added the line (:require ["react-modal" :as react-modal])
to my ns form
do I need to add a line like: (js/goog.exportSymbol "Modal" react-modal)
too?
how do I get a handle on Modal?
I was thinking it was like FlipMove
here https://github.com/reagent-project/reagent/blob/master/doc/InteropWithReact.md#creating-reagent-components-from-react-components
react-modal/Modal
? gives me a reference error
sorry slightly out of my depth in the react/js/cljs ecosystem
if react-modal
only has one export which is the actual modal then just use that directly
:thumbsup: thanks that makes sense looks like it does just have one export too: https://github.com/reactjs/react-modal/blob/master/src/index.js
will try
ok I think I’ve got it working now with :as Modal
.
Thanks a million for your help!
worker.js:126 WebSocket connection to '' failed: Error during WebSocket handshake: Unexpected response code: 403
@dpassen1 see https://github.com/thheller/shadow-cljs/issues/660. it restricts access to localhost by default. how are you accessing it?
Running npx shadow-cljs watch app
on my dev machine and opening up a web browser to port 9000 (we override the port for the shadow-cljs dashboard http server)
0:0:0:0:0:0:0:1 not trusted. Add :trusted-hosts #{"0:0:0:0:0:0:0:1"} in shadow-cljs.edn to trust.
when you work on shadow, what is your workflow? I was looking at adding a ‘name’ config option to the webservers for discoverability for our new engineers
but currently requires a bit of additional setup since https://github.com/thheller/shadow-experiments has no formal release yet but is required by the ui
When we start our app in development, we serve the dashboard at 9000, a version with api routes proxied to a local port on 9010, a version with api routes proxied to a remote dev instance on 9020, and the tests on 9999
{:dev-http
{9010
{:root "..."
:short-name "..."}
9020
{:root "..."
:short-name "..."}
...}
Hmm. I wanted to use shadow-cljs
just for REPL at this moment - so I had no builds defined (I do not target browser yet). But I was unable to run shadow-cljs in Calva in VSCode due to something something nil error (builds list was empty).