devcards
devcards copied to clipboard
Devcards 0.2.6 doesn't work with shadow-cljs
The required namespace "cljsjs.marked" is not available, it was required by "devcards/util/markdown.cljs". The namespace was provided via :foreign-libs which is not supported. Please refer to https://shadow-cljs.github.io/docs/UsersGuide.html#cljsjs fo more information.
devcards use cljsjs dependencies, however shadow-cljs
will ignore cljsjs, you need a shim file.
file: cljsjs/marked.cljs
(ns cljsjs.marked
(:require ["marked" :as marked]))
(js/goog.exportSymbol "marked" marked)
And install the marked
throw npm.
This project includes plenty of shim files, but not include the one for marked
.
https://github.com/thheller/shadow-cljsjs
Here's an example of shadow-cljs with devcards: https://github.com/filipesilva/shadow-cljs-devcards
👍 @DogLooksGood worked for me. For any others who read this, I still needed to add another shim file for React.
Thanks for the example @filipesilva. I didn't use it, but how did you manage to get this to work without shim files? I see you did download marked
in your package.json
. Maybe I'm missing something 😆
@tangjeff0 marked
I just needed to install it. React and react dom I had to import like this before devcards https://github.com/filipesilva/shadow-cljs-devcards/blob/6a09329818ec4390493088ff5f05acf0188a95b6/src/app/core_devcard.cljs#L3-L4. Shadow-CLJS just picked up everything after that.
@filipesilva : thanks for this, I couldn't find this information anywhere else!
I was getting "ReferenceError: React is not defined" and "TypeError: devcards.system.start_ui is not a function" errors - but adding those two requires, [cljsjs.react] and [cljsjs.react.dom] as noted in your link fixed the problem, thanks+++ (added some context to make this easier to google)