Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
khmelevskii opened this issue Feb 16, 2019 · 5 comments
Open

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

khmelevskii opened this issue Feb 16, 2019 · 5 comments

Comments

@khmelevskii
Copy link

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
Copy link

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
Copy link

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

@tangjeff0
Copy link

👍 @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 added a commit to athensresearch/athens that referenced this issue Apr 28, 2020
- requires shims (marked and create-react-class)
- and bhauman/devcards#156
- see https://shadow-cljs.github.io/docs/UsersGuide.html#cljsjs

closes #6
@filipesilva
Copy link

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants