Fork me on GitHub
#shadow-cljs
<
2018-03-25
>
eoliphant00:03:00

Hi, I’m trying to play around with a js lib in the REPL. based on my reading, the import below should be something like this? (require '["auth0-js" :default auth0]). auth0 is nil after the require

import auth0 from 'auth0-js';

export default class Auth {
  auth0 = new auth0.WebAuth({

thheller00:03:36

@eoliphant unfortunately it depends on the packaging on npm. most likely that was converted by babel and might work differently

thheller00:03:59

try with :as and inspect the object

eoliphant00:03:24

ok checking it out. also, i’d typed an earlier comment but realized it was at least partly in error. But still seeing some weirdness. When I do a (require..) in the repl, it doesn’t seem to ever return the ‘nil’. at first i thought it wasn’t working at all, but I could say call str/blank? after require’ing clojure.string, etc. It threw me a little with this because I wasn’t sure the require itself was working

eoliphant00:03:44

hmm the :as is also resulting in auth0 being nil

eoliphant00:03:50

looking at the source…

thheller00:03:20

I can take a look tomorrow. please open a ticket so I don't forget to look at it

eoliphant00:03:51

sure no prob

thheller13:03:04

I'm seriously struggling to find a better message than There is no connected JS runtime.. Please help!

thheller13:03:57

means that the compiled JS output was not loaded or has not connected back to the REPL server

thheller13:03:13

ie. not opened the thing in the browser or launched the node app

thheller14:03:03

changed it so you can't switch the REPL if no client is connected

thheller14:03:18

still pretty bad error message so. would love some suggestions.

thheller14:03:40

(shadow.cljs.devtools.api/nrepl-select :browser)
=> [:no-client :browser "Please load your JS to connect to the REPL."]

lwhorton16:03:23

is there a way to use lein’s repl but shadow-cljs’s cljs compliation? is that even possible when we start talking about connecting to browser sessions? the reason I ask is that the lein repl is just much more robust and developed, but shadow-cljs has much nicer cljs compilation and node module support

justinlee17:03:28

“No application has connected to the nREPL server. Make sure your JS environment has loaded your compiled ClojureScript code.” @thheller how about something like that?

javi17:03:48

hi , my laptop chrashed and on reboot, when i run .... shadow-cljs watch app results in

shadow-cljs - config: /Users.......vc/shadow-cljs.edn version: 2.1.6
shadow-cljs - socket connect failed, server process dead?

javi17:03:53

any ideas?

thheller18:03:40

@fj.abanses delete .shadow-cljs/*.port. 2.2.18 which I released today handles such crashed more gracefully.

thheller18:03:55

@lwhorton if you want to embed in lein and want to use a remote nREPL you need to configure the shadow-cljs middleware. https://shadow-cljs.github.io/docs/UsersGuide.html#_embedded_nrepl_server

lwhorton02:03:08

so is it possible then to have shadow-cljs “controlled” by lein, where say “lein repl -> (fig-start)” actually starts an nREPL but defers to shadow-cljs for the compilation and properly intercepts the repl?

thheller08:03:27

take a look at the docs and shadow.cljs.devtools.api. calling (shadow.clsj.devtools.api/compile :foo) is identical to shadow-cljs compile foo. same for watch and release.

thheller18:03:44

besides that you can just use the clojure api to use shadow-cljs. https://shadow-cljs.github.io/docs/UsersGuide.html#embedded

thheller18:03:18

@lee.justin.m sounds good. I'll add that later.

javi18:03:15

@thheller thanks. upgrading to 2.2.18 fixed it