This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-20
Channels
- # announcements (9)
- # aws-lambda (5)
- # babashka (26)
- # beginners (200)
- # bristol-clojurians (2)
- # calva (74)
- # cider (22)
- # clj-kondo (8)
- # cljsrn (1)
- # clojure (124)
- # clojure-australia (2)
- # clojure-europe (79)
- # clojure-spec (1)
- # clojure-uk (37)
- # clojurescript (87)
- # cloverage (1)
- # code-reviews (10)
- # conjure (41)
- # cursive (5)
- # datahike (2)
- # datascript (3)
- # datomic (11)
- # docker (4)
- # duct (1)
- # emacs (10)
- # events (1)
- # fulcro (3)
- # graalvm (1)
- # honeysql (3)
- # jobs (1)
- # malli (12)
- # meander (51)
- # off-topic (83)
- # pathom (28)
- # quil (3)
- # reagent (19)
- # reitit (3)
- # releases (1)
- # shadow-cljs (49)
- # spacemacs (2)
- # sql (5)
- # startup-in-a-month (1)
- # testing (1)
- # xtdb (8)
I’m getting an error when importing and using a module
Here’s how it’s imported:
[“@react-native-community/cameraroll” :default CameraRoll]
Here’s how it’s used:
(. CameraRoll save (.-uri (<p! (. @!camera recordAsync))))
Here’s the error:
undefined is not an object (evaluating ‘shadow.js.shim.module$ $react_native-community$cameraroll.default.save’)
How to fix this error?
@ps same problem as always. it might not be :default
it might be :as
or :refer
. [“@react-native-community/cameraroll” :as CameraRoll]
or [“@react-native-community/cameraroll” :refer (CameraRoll)]
Is it possible to modify: https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/api.clj#L114?
cache-blockers
Ok got it!
Thank you @thheller
There is like 5 seconds delay between i save the cljs file and shadow recompiling it.
yeah I heard reports that its a lot slower there since they removed some stuff basically all CLJ(S) projects used
Hi everyone, I’m setting up a fullstack project with deps.edn
and shadow-cljs.edn
, and I have a “clj” and a “cljs” folder in src. I want shadow-cljs.edn
to manage the cljs dependencies, but they are not being recognized at all. If I set :deps true
I can successfully manage them from deps.edn
instead, but I would prefer not having to do that. Any ideas what I might be doing wrong?
Oh and here’s shadow-cljs.edn
:
{:source-paths ["src/cljs"]
:dependencies
[[re-frame "1.1.2"]
[reagent "0.9.1"]]
:builds
{:app {:target :browser
:output-dir "resources/public/js"
:asset-path "/js"
:modules {:main {:init-fn wallet.core/init}}
:devtools {:http-root "resources/public"
:http-port 4200}}}
:nrepl {:port 9000}}
and deps.edn
:
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
metosin/reitit {:mvn/version "0.5.10"}
http-kit/http-kit {:mvn/version "2.5.0"}}
:paths ["src/clj" "resources"]
:aliases {:run {:main-opts ["-m" "wallet.core"]}}}
@thheller My namespaces in src/cljs are not being recognized, and neither are the required dependencies, as you can see in this screenshot
Cursive doesn't support shadow-cljs.edn so it doesnt "see" the source-paths and dependencies
If anyone else looks at this thread and notices that I forgot to add :as reagent
and :as re-frame
in the requirements, that was just when I quickly prepared the code to demonstrate. The problem persists with correct requirements and is due to Cursive, like thheller explained:)
Is there a way to use the compiler option {:warnings-as-errors true}
with cljs.js/eval-str
?
It looks like the available options of [cjs.js/eval-str](https://cljs.github.io/api/cljs.js/eval-str) are limited.
(defn evaluate [s callback]
(cljs.js/eval-str
compile-eval-state
s
nil
{:eval cljs.js/js-eval
:load (partial shadow.bootstrap/load (analyzer/empty-state))
:warnings-as-errors true
:context :expr}
(fn [result] (do (js/console.log result)
(callback result)))))
I also tried to pass compiler-options as an argument of analyzer/empty-state
but I had no success.sorry can't help with self-host questions much. can't expect shadow-cljs features to work there since that is using all the regular cljs compiler stuff without any of the shadow-cljs additions/tweaks
Hi There,
I have shadow.cljs application, when I run yarn build
, it gives generates build file main.js. After linking the css and main.js to index.html it gives error on some of the assets file for ex png images. The css file background-image: url("/icons/square.png")
these gives 404.
Any help would be appreciated!
I guess you are looking at the file without an http server? just opening the index.html?
after linking up all the file, everything loads main.js css file except background-image: url (“”)