This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-24
Channels
- # 100-days-of-code (7)
- # announcements (1)
- # bangalore-clj (1)
- # beginners (87)
- # boot (6)
- # cljdoc (16)
- # cljsrn (13)
- # clojure (32)
- # clojure-dev (30)
- # clojure-italy (18)
- # clojure-nl (4)
- # clojure-serbia (1)
- # clojure-uk (48)
- # clojurescript (18)
- # cursive (18)
- # datascript (1)
- # datomic (7)
- # events (9)
- # figwheel-main (28)
- # fulcro (2)
- # hyperfiddle (2)
- # immutant (8)
- # jobs (16)
- # liberator (4)
- # nyc (2)
- # pedestal (15)
- # re-frame (8)
- # reagent (12)
- # reitit (8)
- # remote-jobs (1)
- # ring-swagger (2)
- # robots (1)
- # rum (1)
- # schema (1)
- # shadow-cljs (45)
- # spacemacs (49)
- # sql (13)
- # tools-deps (59)
- # uncomplicate (1)
- # vim (10)
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 https://github.com/reagent-project/reagent/blob/v0.7.0/src/reagent/impl/util.cljs#L12)
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: https://github.com/jakubholynet?tab=repositories)
@holyjak shadow-cljs doesn't hide anything from you. the pattern reagent uses is just not compatible with node
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?
you can try to call (set! js/global.React react)
with (:require ["react" :as react])
note that the cljsjs version it depends on it completely irrelevant as that won't be used
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
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"
:gatsby/graphql
"query IndexQuery {
site {
siteMetadata {
description
}
}
}"}
[props]
(r/as-element
[:h1 "hello world!"]))
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 https://github.com/thheller/gatsby-cljs/blob/master/src/main/shadow/gatsby.clj
could be made easier with macros properly but I didn't use any since metadata is probably enough
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.
:error
[1:0]~shadow.user=> (shadow/once :devcards)
[:devcards] Compiling ...
The required namespace "devcards.core_card" is not available.
:error
[1:0]~shadow.user=>
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?
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 https://clojureverse.org/t/shadow-cljs-and-leinigen-and-npm-oh-my/2735/22 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)
1
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 (Compiler.java:6792)
clojure.lang.Compiler.analyze (Compiler.java:6729)
clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3813)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7005)