bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 116 forks source link

Devcards 0.2.6 doesn't work with shadow-cljs #156

Open khmelevskii opened 5 years ago

khmelevskii commented 5 years ago

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.

DogLooksGood commented 5 years ago

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

filipesilva commented 4 years ago

Here's an example of shadow-cljs with devcards: https://github.com/filipesilva/shadow-cljs-devcards

tangjeff0 commented 4 years ago

👍 @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 😆

filipesilva commented 4 years ago

@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.

ghufransyed commented 4 years ago

@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)