This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-05
Channels
- # announcements (3)
- # beginners (225)
- # calva (3)
- # cider (110)
- # circleci (18)
- # clj-kondo (15)
- # cljdoc (1)
- # cljsrn (12)
- # clojure (77)
- # clojure-dev (39)
- # clojure-europe (3)
- # clojure-houston (2)
- # clojure-italy (9)
- # clojure-nl (16)
- # clojure-romania (1)
- # clojure-spec (5)
- # clojure-uk (20)
- # clojuredesign-podcast (28)
- # clojurescript (89)
- # core-async (4)
- # cursive (10)
- # datomic (3)
- # defnpodcast (5)
- # emacs (17)
- # events (1)
- # figwheel (4)
- # graalvm (6)
- # juxt (1)
- # pathom (4)
- # pedestal (5)
- # re-frame (4)
- # remote-jobs (3)
- # rewrite-clj (4)
- # shadow-cljs (90)
- # spacemacs (2)
- # sql (7)
- # tools-deps (4)
- # vim (52)
- # xtdb (7)
I also want to know what is the down side or limitation of eval loader-mode, for it is not the default loader-mode.
@doglooksgood no. master
has the switch to eval
as a default but it is incomplete and cannot be used yet
but with the eval
stuff in master
it is currently not possible to use images so that needs to be solved before I can release that
I think most people is considering js/require
is the non-magic way. But it is the magic in React-Native.
Hi. I have a problem with setting up emacs/cider with shadow-cljs following this doc: https://shadow-cljs.github.io/docs/UsersGuide.html#_launch_the_clojurescript_repl after cljs.repl> prompt appears, if I try to call anything I get 'no applicaiton has connected to the repl server' it looks like it can be a problem with my app type, :node-script any ideas?
shadow-cljs.edn is here: https://pastebin.com/JpmhZpNg
sorry, it doesn't make sense to me. I ran shadow-cljs node-repl
in another terminal, it said shadow-cljs - connected to server
, but emacs REPL still gives the same error
@alexeiz I'm sorry but I don't know how cider works either. It should ask you which build to connect to and in this case it would be :node-repl
I just tried it, the error I get is 'no build with id: :node-repl'. The only thing that works is ':app' because it's defined in my shadow-cljs.edn
what you suggested earlier does not work, I get 'no build with id: :node-repl' error.
more specific on what? if you want to REPL into :app
you need to run node target/main.js
manually elsewhere
if you want to REPL into node-repl
I can't help you since I have no clue how cider handles that
the error you get might be from cider trying to start a node-repl build which would be incorrect
@alexeiz it doesn’t sound like shadow-cljs node-repl
is what you want.
What should happen is:
1. Run cider-jack-in-cljs
, choose shadow
for repl type, and then enter your node app build ID. If it asks you to open a browser window, say no.
2. Once you see the “build completed” message for the first time in the CIDER REPL buffer, in a terminal session run node <path/to/output.js>
like configured in your shadow-cljs.edn
If you have devtools enabled, it should start the app and keep it open, hot loading your changes while you develop your app
@lilactown it is better to just use node-repl
since there is no point linking to a specific build if you just want a REPL
Is there a trick to getting node_modules to be accessible in a CLJS repl for a :browser configuration? I'm trying to use the aws-sdk and I keep getting a module$node_modules$aws_sdk$lib$aws
error
This maybe my own misunderstanding about how macros get compiled, but I put together a gist for a usecase I have that won’t recompile when I change a .clj file that .cljc file depends on that exports a macro I’m using: https://gist.github.com/colinkahn/2bbeac1573f923e187301704a7283cd3
What I’m seeing is that if you change something in settings, like the foo
def, no matter which file you save that won’t be recompiled with project.module
or project.core
.
@colinkahn yes macro dependencies are not tracked properly and trigger no recompiles. see https://github.com/thheller/shadow-cljs/issues/495
@thheller what’s the difficulty of tackling something like that? I’d be interested in trying to fix it if you think it’s not too hard.
@thheller - if we're building a :browser target can we still access the NPM modules automatically? The docs seem to suggest that should be straightforward - but for some reason I can't get things to work in my REPL - is there a :browser example with npm dependencies anywhere that I could take a look at?
@chris547 yes that generally should work. just fire up shadow-cljs browser-repl
and run (require '["whatever-from-npm" :as x])
not 100% of all packages work though so look at the console log if something throws on load or so
@thheller - that appears to work - thanks! That wasn't working with a watch
but the browser-repl
seems to be much better
@thheller - I think the problem is that when I try to connect via Cursive to the nREPL port - things don't work well - but running shadow-cljs browser-repl
does from the resulting prompt
@thheller - thank you for your patience - it looks like if i connect with Cursive and then run (shadow/watch :browser-repl) (shadow/repl :browser-repl)
then I can connect like the prompt
I think I have my :frontend configuration somehow different than :browser-repl - is there an example configuration you can point me to for browser+npm dependencies?
@thheller - okay it seems to be there's a difference between `(ns io.foo.organization
(:require ["aws-sdk" :as AWS]))` and (require '["aws-sdk" :as AWS])
- when I run the latter it seems to load the module, but the ns require seems to not load the AWS var properly
No stacktrace when I execute ns
however, when I try to reference AWS
I get this:
ReferenceError: module$node_modules$aws_sdk$lib$aws is not defined
at eval (eval at <anonymous> (), <anonymous>:1:1)
at
at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] ()
at Object.shadow$cljs$devtools$client$browser$repl_invoke [as repl_invoke] ()
at shadow$cljs$devtools$client$browser$handle_message ()
at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] ()
at WebSocket.<anonymous> ()
but then I can execute (require '["aws-sdk" :as AWS])
in the same namespace and then the AWS reference begins to work properly
Yes, I connect, then open the file in Cursive and execute the ns
s-expression in the REPL
and that works in a freshly launched shadow-cljs browser-repl
but not in a regular :browser
build?
The result is the same - the ns
command returns nil but does not create the AWS references in the :brower-repl version
@thheller - just closing the loop on this - the namespace I was working in was in a file that wasn't referenced by anything in my app namespace.
I was starting a REPL then trying to load this new ns in the REPL - at that point it wouldn't load npm references in the ns
macro and so I had to use the (require..)
function in the namespace.
Thinking on it overnight I realized that this new ns wasn't referenced by the app and so I added it to the app's ns and now things work.
So, I don't know if that's intended or not but it looks like there just has to be a path to the desired ns at repl startup or else things get a little off.
Thanks for your help and for making such a great tool.