This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-15
Channels
- # announcements (1)
- # beginners (101)
- # boot (13)
- # cider (38)
- # cljdoc (10)
- # cljs-dev (37)
- # cljsrn (6)
- # clojure (74)
- # clojure-dev (8)
- # clojure-europe (3)
- # clojure-italy (36)
- # clojure-losangeles (2)
- # clojure-nl (5)
- # clojure-spec (15)
- # clojure-uk (49)
- # clojuredesign-podcast (2)
- # clojurescript (52)
- # cursive (6)
- # datomic (19)
- # fulcro (35)
- # graalvm (16)
- # graphql (4)
- # kaocha (1)
- # leiningen (26)
- # luminus (3)
- # re-frame (10)
- # reagent (14)
- # ring-swagger (37)
- # rum (2)
- # schema (4)
- # shadow-cljs (148)
- # spacemacs (13)
- # specter (1)
- # sql (46)
- # tools-deps (3)
- # vim (4)
hello, guys, I have some problems with using shadow-cljs
, leiningen
and cursive IDE
in Intellij. I want to start a repl of clojurescript in the Intellij, and do as following:
Add a port config in shadow-cljs.edn
clojure
:nrepl {:port 9600}
Add Edit Configurations
in Intellij
I add a Clojure REPL of Remote with the Host 127.0.0.1, and Port 9600.
Start shadow-cljs Server in Terminal
I open a terminal and do:
# app is the app-id
$ shadow-cljs watch app
Run the REPL to connect the Server in Intellij
I click the green button of the run
in the left-top of of Intellij.
As default, it will connect a clojure REPL, and I can't switch it to clojurescript REPL. How should I do? And I also want to load the project to REPL, too. Is there anyone having an experience about it?:npm-module
is tricky with regards to REPL setup. can you not use the proper :react-native
target?
@thheller. I use the` npm-module` in App.js
, it's convenient, so I don't think more about it. The :react-native
target is enough simple?
and then manually in App.js
require("./app/shadow.cljs.devtools.client.react-native")
in cursive you then call (shadow.cljs.devtools.api/repl :app)
to switch to the CLJS repl for :app
@thheller. It works well to switch clojure REPL to clojurescript's. I'm using Expo and React Native to do an app. After do as above, any input will get No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
@thheller. I think it's beacause of configuration in App.js. What should I do after require("./app/shadow.cljs.devtools.client.react-native")
in App.js
? Are there another operations in App.js
? At beginning, I just refer npm-module
compiled and export a App()
, just as default of expo init
yields.
Yes, maybe something about websocket
, I start expo
and run it on IPhone, then it print WebSocket disconnected
with a long Map.
and if that is the wrong one you can override it with shadow-cljs watch app --config-merge '{:local-ip "1.2.3.4"}'
I'm so sorry bothering you again. But it still doesn't work after I try to set local-ip
. I don't know how the shadow-cljs work and which ip
to set for it. It's My work environment:#1. start shadow-cljs
and expo
on two terminals; #2. set shaodw-cljs nREPL port 9600, which in localhost
and LAN
, you can connecnt it in any one; #3. set Cursive nREPL remote host and port 127.0.0.1:9600
; #4. Run app on IPhone by QR code with LAN
option
so do you know how to look up your network ip? might be something like ifconfig
but I can't remember
google that part. nothing to do with either react-native or shadow-cljs. purely your OS IP is needed
I have try it, use the IP of my OS. But it doesn't work, and the repl print No application has ....
too
The message is telling you what your react-native app on your iphone has not connected back to the shadow-cljs process
Ok. I will give a specific list of it. I'm sorry for that, thanks for your sincere help. I'm a rookie in Clojure, so there are many thing unknown.
yeah. I'm writing a REPL troubleshooting guide currently. hopefully that explains things a bit better than I can do here in slack
I have run it by use ":target :react-native" successfully. But when use ":npm-module" as ":target", it seems websocket problem.
which according to your ip config would be running at http://192.168.50.244:9630
The ip of http://192.168.50.244:9630 has the content of "loading...", and the title is my app name.
I learn the expo
docs first, it looks like use App.js
as a entry file is very simple, and needn't manually add AppRegistry
. So I do it as in clojurescript.
https://github.com/thheller/reagent-expo here is expo example
Hi, @thheller. In development, shadow-cljs will generated bunch of files, can I separate entry files from other files? since the release mode there should be only entry files, I want to keep the directory clean. I can add a second path to source paths, I just wonder can I tell shadow-cljs to put the file there?
@doglooksgood the files are generated there to stop a metro exception from happening
if they aren't there metro will throw an exception when displaying redbox/yellowbox dialogs
release builds don't use them so you could just rm -rf app/* && shadow-cljs release app
@thheller. I use the` npm-module` in App.js
, it's convenient, so I don't think more about it. The :react-native
target is enough simple?
@thheller. It works well to switch clojure REPL to clojurescript's. I'm using Expo and React Native to do an app. After do as above, any input will get No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
dumb question I couldn’t figure out from the docs - where do I put an init function that I want to be called only in dev.
Thinking about preloads, but should the function then be at the top level in the namespace or does it need some metadata
(it’s a websocket reconnection for remote inspection)
Alright, 99% done my conversion from lein to shadow-cljs. Latest issue, I am trying to replace our dependency on the lein-cljfmt
plugin. I am trying to run cljfmt using shadow-cljs run
but it looks like shadow-cljs is trying to consume my --file-pattern argument for itself.
try npx shadow-cljs run cljfmt.main/-main -- fix --file-pattern '\/[^.]+\.clj[sxc]?$' src test
Ya, I've definitely seen an used that often when dealing with git ... just didn't think to try it with shadow-cljs
Hello! I'm trying to use shadow-cljs
with Cider, but got this error:
user> (server/start!)
Aug 15, 2019 8:05:01 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.7.2.Final
Aug 15, 2019 8:05:01 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.7.2.Final
Aug 15, 2019 8:05:01 PM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 2.3.2.Final
shadow-cljs - server version: 2.8.42 running at
shadow-cljs - nREPL server started on port 9876
:shadow.cljs.devtools.server/started
user> (shadow/watch :app)
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (175 files, 1 compiled, 0 warnings, 2.73s)
:watching
user> (shadow/nrepl-select :app)
Execution error (IllegalStateException) at shadow.cljs.devtools.api/nrepl-select (api.clj:377).
Can't change/establish root binding of: *nrepl-cljs* with set
last two linesmight need to use the ns shadow.cljs.devtools.server.nrepl04
instead of shadow.cljs.devtools.server.nrepl
@thheller thanks for the reply, I'm very sorry I didn't point out I want specify a output-to
at :browser
target.
I want make my src/main/resources/public/compiled
directory clean.
Of course I can delete it before build.
hi... not specific to shadow-cljs
at all, but: Any recommendations or common practice to separate CLJ vs CLJS deps (in the same source tree)? All open projects I've looked at seem to keep all deps together... which I don't like
when using lein
I usually create a :cljs
profile there I put my CLJS deps (eg. the shadow-cljs project itself)
I have also just put CLJS deps in shadow-cljs.edn
and server side in a separate deps.edn
is there a way to tell shadow-cljs
the name of the deps.edn
file? (say, deps.cljs.edn
?).
in project.clj
, this seems to work: :lein-tools-deps/config {:config-files [:install :user "./deps.clj.edn"]}
sure, I'm just saying... for the server-side piece (using lein) that's one way I found which might work
Has anyone successfully compiled a rum project using shadow-cljs? I used npm to install react, react-dom, and create-react-class per https://shadow-cljs.github.io/docs/UsersGuide.html#_missing_js_dependency and https://github.com/thheller/shadow-cljs/issues/199. When I try to compile a simple hello-world application that does nothing other than require rum.core I get The required JS dependency "object-assign" is not available, it was required by "node_modules/react/cjs/react.production.min.js".
Yes, I'm aware I could also use npm to install object-assign, but this just doesn't seem right to me. Sorry, I'm sure this is a question that's repeatedly asked. I've looked at a lot of examples and I don't see anything different between them and what I have. PS - I did repeatedly npm install
all missing dependencies and it does eventually compile.
object-assign
should have been installed when you did npm install react
since it is listed as one of its dependencies? https://unpkg.com/[email protected]/package.json
it sometimes gets into a confused state if too many node_modules
folders are modified
Yes, it was installed underneath react/, not at the top-level of node_modules/ which appears to be required by shadow-cljs
a lot has changed in npm however so I'd definitely upgrade that since it has gottan way more reliable
OK. So I upgrade though I don't think that matters. Witness:
# npm install -g ...
# ll /usr/lib/node_modules/
drwxr-xr-x 1 root root 4096 Aug 15 20:52 ./
drwxr-xr-x 1 root root 4096 Aug 15 20:51 ../
drwxr-xr-x 3 root root 4096 Aug 15 20:52 create-react-class/
drwxr-xr-x 8 root root 4096 Aug 15 20:51 npm/
drwxr-xr-x 5 root root 4096 Aug 15 20:52 react/
drwxr-xr-x 5 root root 4096 Aug 15 20:52 react-dom/
Vs
# npm install ...
# ll node_modules/
drwxr-xr-x 25 root root 800 Aug 15 20:55 ./
drwxr-xr-x 19 root root 608 Aug 15 20:55 ../
drwxr-xr-x 3 root root 96 Aug 15 20:55 .bin/
drwxr-xr-x 10 root root 320 Aug 15 20:55 asap/
drwxr-xr-x 20 root root 640 Aug 15 20:55 core-js/
drwxr-xr-x 9 root root 288 Aug 15 20:55 create-react-class/
drwxr-xr-x 9 root root 288 Aug 15 20:55 encoding/
drwxr-xr-x 10 root root 320 Aug 15 20:55 fbjs/
drwxr-xr-x 8 root root 256 Aug 15 20:55 iconv-lite/
drwxr-xr-x 6 root root 192 Aug 15 20:55 is-stream/
drwxr-xr-x 14 root root 448 Aug 15 20:55 isomorphic-fetch/
drwxr-xr-x 7 root root 224 Aug 15 20:55 js-tokens/
drwxr-xr-x 10 root root 320 Aug 15 20:55 loose-envify/
drwxr-xr-x 13 root root 416 Aug 15 20:55 node-fetch/
drwxr-xr-x 6 root root 192 Aug 15 20:55 object-assign/
drwxr-xr-x 17 root root 544 Aug 15 20:55 promise/
drwxr-xr-x 14 root root 448 Aug 15 20:55 prop-types/
drwxr-xr-x 9 root root 288 Aug 15 20:55 react/
drwxr-xr-x 18 root root 576 Aug 15 20:55 react-dom/
drwxr-xr-x 9 root root 288 Aug 15 20:55 react-is/
drwxr-xr-x 9 root root 288 Aug 15 20:55 safer-buffer/
drwxr-xr-x 12 root root 384 Aug 15 20:55 scheduler/
drwxr-xr-x 5 root root 160 Aug 15 20:55 setimmediate/
drwxr-xr-x 12 root root 384 Aug 15 20:55 ua-parser-js/
drwxr-xr-x 8 root root 256 Aug 15 20:55 whatwg-fetch/
# nodejs -v
v12.8.1
# npm -v
6.10.2
Looks like global installs cannot be supported by shadow-cljsnot sure why you'd be doing that but if npm is installing things differently there then yes that isn't supported