Fork me on GitHub
#shadow-cljs
<
2021-11-09
>
bmaddy03:11:15

I'm trying to get https://github.com/fulcrologic/fulcro-rad-demo running and am having trouble getting the cljs repl working in emacs. I bumped the cljs version to 1.10.879 to match what I think shadow-cljs 2.15.12 wants but I'm still getting user-error: The shadow-cljs ClojureScript REPL is not available. When I look at *nrepl-messages* I see this:

(-->
  id         "8"
  op         "eval"
  session    "844724f8-aa75-4953-bd4e-6ed230a647bf"
  time-stamp "2021-11-08 20:48:50.415368000"
  code       "(require 'shadow.cljs.devtools.api)"
)
...
(<--
  id         "8"
  session    "844724f8-aa75-4953-bd4e-6ed230a647bf"
  time-stamp "2021-11-08 20:48:51.723743000"
  err        "Execution error (NoClassDefFoundError) at jdk.internal.reflect.NativeMethodAccessorImpl/invoke0 (NativeMethodAccessorImpl.java:-2).
Could not initialize class com.google.javascript.jscomp.DiagnosticGroups
"
)
...
Does that error mean anything to anyone? Any idea where to look next?

thheller06:11:15

@bmaddy 2.15.13 or 2.26.0 want that cljs version. see https://clojars.org/thheller/shadow-cljs

thheller06:11:06

I don't use emacs though so I can't say anything other than what their docs already say

thheller06:11:27

if that require does anything though I guess you are not connected to the shadow-cljs nrepl? otherwise it should be loaded already

bmaddy21:11:58

I was able to get yarn shadow-cljs cljs-repl :main to evaluate code once I had yarn shadow-cljs watch :main running somewhere else and my browser loaded. That sounds to me like the problem is firmly on the #cider side of things. Thanks for the thoughts here and for the excellent REPL troubleshooting documentation--that cleared some stuff up for me.

Stefan08:11:09

I think I’m experiencing this issue: https://github.com/thheller/shadow-cljs/issues/948. In development everything works fine, since I have the compiler option :output-feature-set :es8 active. But in release mode, I get the error described in the issue. I’m assuming I shouldn’t use that compiler option in release mode. Does anyone have a solution/work-around?

Stefan11:11:15

Not sure if this is the best solution, but we’re now using this in release mode:

:release {:compiler-options {:output-feature-set :es5}}
This fixes the issue for us.

thheller10:11:59

this should absolutely not be required. can you try if this is maybe related to incremental compiles?

thheller10:11:43

if you get the error on shadow-cljs release just wipe the .shadow-cljs/builds/<your-build-id>/release dir and try again

thheller10:11:59

if that works it appears to be related to incremental compiles

thheller10:11:36

I just fixed the other issue but your problem description seems different so I'm not sure they are actually related

thheller10:11:53

especially since switching the :output-feature-set will cause a cache wipe anyways

Stefan08:11:42

Thanks for your feedback @U05224H0W. Wiping out the .shadow-cljs folder unfortunately doesn’t fix it. And I do think it’s the same issue, because it’s also for me the Col element in react-bootstrap (now version 2.0.0, no longer rc). I just now updated shadow-cljs to 1.16.2. The steps that I’m doing: • rm -rf .shadow-cljs node_modules • npm i • npx shadow-cljs -A:my-client server • npx shadow-cljs -A:my-client release :my-client I then request my HTML page through the dev server and I get TypeError: $jscomp.makeIterator is not a function in the JS console. Leaving out the Col element makes the error disappear. I can try to make a small reproduction project if that helps.

thheller08:11:02

so as far as I can tell the problem seems to be that the closure compiler rewrites some code expecting some polyfills (eg. $jscomp.makeIterator) to be available. normally when it does such replacements it also ensures that the polyfills will be injected itself. somehow something in the Col file however only causes the rewrite without ensuring its actually present

thheller08:11:21

the fix I made seemed to work around the problem somewhat reliably but I guess not for your case

thheller08:11:58

so a repro might help track it down further although I made a minimal case that ONLY included Col and that worked just fine

thheller08:11:05

so dunno how to make it more minimal 😛

thheller08:11:35

but I have to ask since it is such a common mistake: when you updated shadow-cljs did you actually update it in deps.edn or only package.json?

Stefan08:11:07

I updated both 🙂

Stefan08:11:56

Maybe your reproduction scenario was too minimal then? 😛 I’ll try to setup something up later this morning!

Stefan12:11:08

@U05224H0W I have created a small repo that reproduces the issue for me. I think for the error to occur, the Col must be inside a Row and/or Container; just the Col may not trigger that code path. https://github.com/svdo/shadow-cljs-948

thheller20:11:42

this works fine for me?

Stefan07:11:07

Really? 🤯 I’ll have a coworker try as well and get back. Very strange. You did the steps exactly like I described in the README right?

thheller07:11:55

nah nevermind got it reproduced

thheller07:11:11

I'll see about adding a workaround

thheller07:11:42

it should work in 2.16.4 if you add :js-options {:force-library-injection #{"es6/util/makeiterator"}} to your build config

🙏 1
Stefan09:11:45

@U05224H0W Your skills never cease to amaze me, this is great Thomas!!!

Rachel Westmacott09:11:30

Morning all! Enjoying shadow-cljs here! Unfortunately my search-fu it failing me and I can't find out if there's a way to make it automatically open a web page when compilation first completes. I'm sure that used to be a thing.

thheller17:11:42

@peterwestmacott that was never an option. figwheel does this but shadow-cljs does not

Rachel Westmacott17:11:17

Ah, okay. Thanks for letting me know.

Rachel Westmacott17:11:26

Awesome tool btw, love it!

Rachel Westmacott17:11:11

Would you consider it a desirable feature? Or is it definitely out of scope?

thheller17:11:12

It is not desirable for me personally but that doesn't mean I wouldn't allow adding an option for it. shadow-cljs already does open a browser for shadow-cljs browser-repl since for that it has all the info. for the other stuff you might need to add a config option for it to work.

👍 1