Fork me on GitHub
Jakub Holý (HolyJak)09:09:54

Can anybody shed a light why shadow-cljs release hides js/React from my code? I use shdow-cljs to produce an npm-module, which is then consumed by a .js file, processed by Webpack (during a gatsby build run). When I shadow-cljs compile app then everything works just fine. However, when I do shadow-cljs release app instead then webpack fails with > WebpackError: js/React is missing (thrown from Why? What can I do to fix it? (The .js file that requires my cljs-based npm module does import React) Thansk a lot!!!! (Here is the code:


@holyjak shadow-cljs doesn't hide anything from you. the pattern reagent uses is just not compatible with node


you should upgrade to the latest reagent version

Jakub Holý (HolyJak)09:09:42

I did not mean to defame shadow-cljs 🙂 Thanks a lot, awesome that you know what the problem is. However I cannot upgrade easily as I have to use React 15 and Reagent 0.8 requires 16. Do you think that somebody in #reagent could help? Or is there anything else I can do? I guess what Reagent does somehow fails under :advanced for some reason?


0.8.1 I believe


you can try to call (set! js/global.React react) with (:require ["react" :as react])


why does reagent require v16? I don't think thats true


note that the cljsjs version it depends on it completely irrelevant as that won't be used


it will use the react version you installed via npm in your project


so if you install v15 you should be good to go?

Jakub Holý (HolyJak)09:09:41

I don't know, I saw that reagent v8 updated to React 16 and I have assumed it is not backwards compatible with 16 but I haven't really tried. I will try to upgrade then. I have v15 installed (and it worked in dev, non-release). I will also try the call you suggested. Thanks a lot, you are extremely helpful!


try upgrading first. I don't think reagent adopted any of the newer lifecycle methods yet so it shouldn't matter


it works in dev because the development loader works differently there

👍 4

@holyjak I think you are making things a bit more complicated than they need to be


damn gatsby is one gigantic mess


seriously wtf ...

Jakub Holý (HolyJak)12:09:34

Thanks a lot, upgrade to Reagent 0.8 solved the problem and it now works with release just nicely


@holyjak I got curious about the gatsby stuff an implemented a minimal example of how I would approach this


(defn page-index
  {:export true
   :gatsby/page "index"
   "query IndexQuery {
      site {
        siteMetadata {
    [:h1 "hello world!"]))


basically the idea is that you create a normal clojure function for each page


add some metadata to it that a build hook will then extract and create the src/pages files


it bypasses all the other gatsby stuff basically. you just write a function per page


not a clue how the dynamic createPages stuff would work but should be simple to hook up AFAICT


granted that I would not expect anyone to know how to write the hook but its pretty simple


could be made easier with macros properly but I didn't use any since metadata is probably enough

❤️ 4
Jakub Holý (HolyJak)08:09:28

Man , you rock! I have been working on this in the past three days and you came in a short time with a better and much nicer solution! Thank you!


Hey there! I'm wondering how to fix an update to shadow-cljs. I updated it and now I get The required namespace is not available.


The full error is

ranmason@caesar ~/code/deck-builder (master●●●)$ cd ~/code/deck-builder; rlwrap npx shadow-cljs clj-repl
shadow-cljs - config: /Users/ranmason/code/deck-builder/shadow-cljs.edn  cli version: 2.6.9  node: v10.10.0
shadow-cljs - starting via "clojure"
Sep 24, 2018 8:10:10 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Sep 24, 2018 8:10:10 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
shadow-cljs - HTTP server for :browser available at 
shadow-cljs - HTTP server for :browser-test available at 
shadow-cljs - HTTP server for :devcards available at 
shadow-cljs - server version: 2.6.9
shadow-cljs - server running at 
shadow-cljs - socket REPL running on port 50235
shadow-cljs - nREPL server started on port 8230
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit
[1:0]~shadow.user=> (shadow/once :devcards)
[:devcards] Compiling ...
The required namespace "devcards.core_card" is not available.

[1:0]~shadow.user=> (shadow/once :devcards)
[:devcards] Compiling ...
The required namespace "devcards.core_card" is not available.



I went from 2.5.1 to 2.6.9.


I may have upgraded from 2.0.144, but I don't have the logs from when it worked last.


@clashthebunny did you update devcards in the meantime too? or mess with your source-paths in any way?


devcards.core_card isn't part of devcards itself? is that one of your sources?


you can run shadow-cljs clj-repl (shadow/find-resources-using-ns 'devcards.core_card) to figure out who is using that


I did update it at the same time!


I'll keep digging. Thanks for the pointers.


hey everyone, saw and have been able to connect vim-fireplace to the nREPL started by shadow-cljs watch service I ran :Piggieback :service as well with no confirmation if that worked properly. When I try to evaluate a form that uses reader conditionals (just :clj and :cljs) in a .cljc, I get “Conditional read not allowed”. Is this because :Piggieback is failing, or some other configuration issue?


@nolan its not shadow-cljs since I can use them just fine in the REPL directly

[2:1]~cljs.user=> #?(:cljs 1)


seems to work fine over nrepl as well so its probably vim-fireplace?


looking at the full exception should tell you


right on. i am able to do the same in the repl directly. not a huge issue. I’ll check into it a bit more later. thanks!


about every other time I run my builds, I see this error message:

failed to require :target :browser-test for build :browser-tests
CompilerException: java.lang.RuntimeException: Unable to resolve symbol: defelem in this context, compiling:(hiccup/page.clj:20:1)
	clojure.lang.Compiler.analyze (
	clojure.lang.Compiler.analyze (
	clojure.lang.Compiler$InvokeExpr.parse (
	clojure.lang.Compiler.analyzeSeq (


RuntimeException: Unable to resolve symbol: defelem in this context
	clojure.lang.Util.runtimeException (
	clojure.lang.Compiler.resolveIn (
	clojure.lang.Compiler.resolve (


hmm this was supposed to be fixed a while ago. which version are you on?


2.6.8. it started happening after upgrade to that version from 2.4.x