Fork me on GitHub

OK, so FWIW, I put the same minimal reproducible example up I couldn't get Figwheel to work either. I guess I'll just have to use something with better Node.js support, 😉


ClassCastException: clojure.lang.KeywordLookupSite$1 incompatible with clojure.lang.Named I keep getting these on shadow-cljs watch


it stems from some business in shadow around cljs_hacks


ClassCastException: clojure.lang.KeywordLookupSite$1 incompatible with clojure.lang.Named
        clojure.core/namespace (core.clj:1597)
        clojure.core/namespace (core.clj:1597) (cljs_hacks.cljc:155) (cljs_hacks.cljc:147)
        cljs.analyzer/resolve-existing-var (analyzer.cljc:1276)
        cljs.analyzer/resolve-existing-var (analyzer.cljc:1271)
        cljs.compiler/fn--9175 (cljs_hacks.cljc:740)
        cljs.compiler/fn--9175 (cljs_hacks.cljc:717)


It doesn’t happen every time.


Anyone familiar with being able to use in a shadow-cljs project? I can’t seem to just simply require components even though its shipped as an npm package. Do I need to do some webpack thing first? (their installation docs seem to imply that). Or is there some special path I need to use?


I have tried (:require ["@shoelace-style/shoelace" :refer [SlButton]]) and (:requre ["@shoelace-style/shoelace" :as sl]) and I end up with nil for SlButton or sl/SlButton


@devn do you maybe use shadow-cljs embedded in some CLJ app in combination with some kind of classloader magic or tools.namespace?


I don’t think that’s my situation, but either way, do you have any suggestions for catching what’s actually happening here?


it is extremely unlikely that this is actually a shadow-cljs problem


this is deep inside the clojure core code


so it is much more likely something goin on in your JVM that shouldn't be


how are you running things?


if you are connected over nREPL it might be the nREPL doing stuff


@U05224H0W it’s not always inside the clojure core code. I wish I could get a smaller way to reproduce, but: The project has 3 primary source directories: “shared” (cljc code) “src” (clojure code) “ui-src” (clojurescript code) There is a project.clj which specifies all 3 of these source paths in its source-paths key. This project.clj requires the latest version of clojurescript. In addition, there is a package.json and a shadow-cljs.edn. The shadow-cljs.edn has 3 builds in it, all of which are specified with :entries [the.ns]


The shadow watch is run with npx — shadowcljs 2.11.4 is specified in the package.json


Ugh. I am very embarrassed.


I accidentally IBM’s J9 OpenJDK, not the HotSpot version of AdoptOpenJDK


@rberger read about the default exports. I don't know for this case but it might be (:requre ["@shoelace-style/shoelace" :default SLButton])


@U05224H0W I was able to get it to import with:

(:require ["@shoelace-style/shoelace/dist/custom-elements/index.js" :refer [defineCustomElements setAssetPath SlButton]])
It ends up with an html custom element (web component) now I still have to figure out how to access the element after doing:
(.define js/customElements "sl-button" SlButton)
SlButton is defined as a class, but sl-button is not defined. I probably just need to learn more how web components work with reagent.


ah if its web components you just do [:sl-button ...] like any other regular dom element


thats why the :refer and stuff may not actually exist because you don't need it if it already self-registers


Oh, I didn’t try with the : Now that I try that, it does inject <sl-button>… into the DOM now, but I’m getting a

Uncaught ReferenceError: regeneratorRuntime is not defined
index.js:2654 Uncaught ReferenceError: regeneratorRuntime is not defined
    at initializeComponent (index.js:2654)
    at _connectedCallback (index.js:2944)
    at HTMLElement.connectedCallback (index.js:3049)
    at commitPlacement (react-dom.development.js:8835)
    at commitAllHostEffects (react-dom.development.js:18656)
    at HTMLUnknownElement.callCallback (react-dom.development.js:150)
    at Object.invokeGuardedCallbackImpl (react-dom.development.js:200)
    at invokeGuardedCallback (react-dom.development.js:257)
    at commitRoot (react-dom.development.js:18914)
    at eval (react-dom.development.js:20419)
But at least that is something I can track down now hopefully. Thanks again for your help! Oh, I didn’t try with the


that likely means you are including transpiled code from babel


I think a require for regenerator-runtime might be enough


(:require ["regenerator-runtime"]) should do it in case you didn't try .. you said "refer" which would be incorrect


(maybe npm install regenerator-runtime first of course)


but the script tag is fine too I guess


Yep, (:require ["regenerator-runtime"])`` works great. Preferred to <script> tag Thanks again!


but from the package name I gather its about CSS which shadow-cljs does not handle. so it might be webpack only?


Is there any built-in way of combining watch and release? Basically just want a way of running release every time the files change. watch will call compile on file change, as I understand it, so if there is a way of getting it to run release instead?


not native to shadow in particular, but if you use watchman-make you can do anything you want after files are changed e.g. watchman-make -p './src/***/**.cljs' -t release


(where release would be a target in your Makefile to run shadow-cljs release {target} )


Thanks @U5RFD1733, I opted for the inotifywait route as I already had that installed and didn't need to download anything new 🙂


oh for sure, there's a billion watchers out there. yay unix :)

🎉 1