This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-18
Channels
- # aleph (7)
- # announcements (11)
- # beginners (186)
- # calva (17)
- # cider (26)
- # clj-kondo (4)
- # cljdoc (12)
- # cljs-dev (3)
- # clojars (1)
- # clojure (105)
- # clojure-berlin (1)
- # clojure-chicago (1)
- # clojure-dev (34)
- # clojure-europe (3)
- # clojure-italy (4)
- # clojure-nl (27)
- # clojure-russia (19)
- # clojure-uk (25)
- # clojuredesign-podcast (4)
- # clojurescript (54)
- # cursive (6)
- # data-science (1)
- # datascript (11)
- # datomic (5)
- # emacs (3)
- # events (2)
- # fulcro (13)
- # graalvm (5)
- # jobs (15)
- # leiningen (7)
- # luminus (3)
- # melbourne (1)
- # nrepl (1)
- # nyc (2)
- # onyx (4)
- # pathom (6)
- # pedestal (18)
- # re-frame (19)
- # reagent (10)
- # shadow-cljs (27)
- # spacemacs (32)
- # sql (11)
- # tools-deps (35)
- # vim (50)
re-frame-10x
has a bug when using shadow-cljs whereby require like [react-highlight.js :as react-highlightjs]
leads to an exception due to not binding the correct value, whereas ["react-highlight.js" :default react-highlightjs]
does work. As a library, I will need to maintain support for both standard CLJS/figwheel and shadow-cljs with any fix. Any guidance on how one supports both please ?
@superstructor the problem is with how the CLJSJS package is created. it is basically doing the "unwrapping" of the default export. https://github.com/cljsjs/packages/blob/master/react-highlight/resources/main.js
that should be module.export = Highlight;
and re-frame-10x should be using [react-highlight.js :as react-highlightjs]
and then later when using it react-highlightjs/default
in the adapt-class
call
or alternatively just the typical cljsjs
alias namespace with global variable. like most other packages
the problem is just that it is using the react-highlight.js
ns which maps directly to the npm package
and the variable it exports does not match what you get when you require the package directly because of its Highlight.default
unwrapping
Thanks for the comprehensive investigation and help @thheller! The issue is clear now. I'll think about the most pragmatic solution.
@superstructor just thought of a much simpler solution
in re-frame-10x when using the react-highlightjs
you could just use (or react-highlights/default react-hightlightjs)
@thheller I have a problem referencing JS file from JS file from CLJS. Any JS referenced from CLJS works fine, but got different errors when I import another file here. An example
It worked the first time the compilation went through. After some changes (and the reload) it stopped working
hmm dunno. you can try deleting the .shadow-cljs/builds
dir and restarting the build
@thheller it happens every now and then when the hotreload hits after touching (nested) imported js file - then I need to delete builds
folder from shadow-cljs and it starts to working again. It’s quite easy to reproduce it:
- call JS file from CLJS
- call JS file methods from the above JS file (as an import)
workaround for me here is to pass callbacks or partially run functions in promises from CLJS, but it doesn’t seem to be a solution
@thheller Hah thanks 🙂 :thumbsup: I also thought to go down this route.
I released re-frame-10x 0.4.2
that fixes compatibility with shadow-cljs as per above. Thanks @thheller!
in the process of formatting a project as a monorepo using modules each with a deps.edn + shadow-cljs.edn. shadow is installed globally via yarn.
I moved everything over in a way that I thought was correct but now when running shadow-cljs compile my-app
I’m getting an error:
Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.
when I explicitly add shadow to my deps.edn, this goes away. confused why that might be the case, as it wasn’t listed in my deps.edn pre monorepo migration