This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-07
Channels
- # announcements (27)
- # babashka (29)
- # beginners (280)
- # calva (34)
- # cider (4)
- # circleci (11)
- # cljfx (10)
- # cljsrn (1)
- # clojure (526)
- # clojure-dev (9)
- # clojure-europe (42)
- # clojure-finland (5)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-taiwan (2)
- # clojure-uk (14)
- # clojurescript (40)
- # clr (43)
- # community-development (5)
- # css (4)
- # cursive (7)
- # duct (82)
- # events (1)
- # fulcro (72)
- # garden (44)
- # hoplon (3)
- # java (40)
- # jobs (4)
- # juxt (1)
- # luminus (53)
- # meander (13)
- # off-topic (26)
- # pathom (14)
- # pedestal (3)
- # portal (2)
- # rdf (3)
- # re-frame (54)
- # releases (10)
- # remote-jobs (3)
- # sci (74)
- # shadow-cljs (47)
- # startup-in-a-month (5)
- # testing (9)
- # tools-deps (73)
- # vim (12)
Sometimes I get compilation issues while switching branches, I'm guessing because git may create a reference to a file before it creates the file that is being referred to. Not a huge deal since a page-reload makes it go away, but when watching, how about checking if git is doing an operation before doing the compile? I think this can be done by checking the existence of .git/index.lock
. Not sure if it is worth it, just putting it out there.
Actually for the implementation, since shadow-cljs is already watching for file system changes to .cljs files, how about .git/index.lock as well?
I’m getting ajax.edn is not available
even though I have cljs-ajax/cljs-ajax in deps.edn
How to fix this error?
all my imports in deps.edn aren’t working
are you using :deps true
option?
https://shadow-cljs.github.io/docs/UsersGuide.html#deps-edn
when I use the deps true option I get this error
http://java.io.FileNotFoundException: Could not locate shadow/cljs/devtools/cli__init.class or shadow/cljs/devtools/cli.clj on classpath.
when loading the repl
in particular > You must add the thheller/shadow-cljs artifact to your deps.edn manually.
I added the artifact, but now I get a different error:
Caused by: java.lang.RuntimeException: Unable to resolve var: comp/source-map-data-gen-col in this context
Here’s my shadow-cljs.edn
{:deps true :source-paths [“src”] :dependencies [[reagent “0.10.0"] [re-frame “0.12.0”] [re-frame-steroid “0.1.1"] [rn-shadow-steroid “0.2.1”] [re-frisk-remote “1.3.3"]] :builds {:dev {:target :react-native :init-fn humboi.core/init :output-dir “app” :compiler-options {:closure-defines {“re_frame.trace.trace_enabled_QMARK_” true}} :devtools {:after-load steroid.rn.core/reload :build-notify steroid.rn.core/build-notify :preloads [re-frisk-remote.preload]}}}}
Here’s my deps.edn
{:deps {org.clojure/clojure {:mvn/version “1.10.0”} org.clojure/clojurescript {:mvn/version “1.10.339"} reagent {:mvn/version “0.10.0”} re-frame {:mvn/version “0.12.0"} re-frame-steroid {:mvn/version “0.1.1”} rn-shadow-steroid {:mvn/version “0.2.1"} cljs-ajax/cljs-ajax {:mvn/version “0.8.1”} day8.re-frame/http-fx {:mvn/version “0.2.2"} thheller/shadow-cljs {:mvn/version “2.11.11”}} :paths [“src”]}
that gives the following:
============================================================================= WARNING: The configured :dependencies in shadow-cljs.edn were ignored! When using :deps they must be configured in deps.edn ============================================================================== ============================================================================== WARNING: The configured :source-paths in shadow-cljs.edn were ignored! When using :deps they must be configured in deps.edn ============================================================================== NPM dependency “react” has installed version “16.13.1" “16.13.0” was required by jar:file:/private/var/root/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs [2021-01-07 08:13:51.446 - WARNING] :shadow.cljs.devtools.server/nrepl-ex Note: The following stack trace applies to the reader or compiler, your code was not executed. CompilerException Unexpected error macroexpanding if-ns at (cider/piggieback.clj:22:1). #:clojure.error{:phase :macroexpansion, :line 22, :column 1, :source “cider/piggieback.clj”, :symbol if-ns} clojure.lang.Compiler.macroexpand1 (Compiler.java:7018) clojure.lang.Compiler.macroexpand (Compiler.java:7074) clojure.lang.Compiler.eval (Compiler.java:7160) clojure.lang.Compiler.load (Compiler.java:7635) clojure.lang.RT.loadResourceScript (RT.java:381) clojure.lang.RT.loadResourceScript (RT.java:372) clojure.lang.RT.load (RT.java:463) clojure.lang.RT.load (RT.java:428) clojure.core/load/fn--6824 (core.clj:6126) clojure.core/load (core.clj:6125) clojure.core/load (core.clj:6109) clojure.core/load-one (core.clj:5908) Caused by: NoSuchFieldError ES3 cljs.closure__init.load (:133) cljs.closure__init.<clinit> (:-1) java.lang.Class.forName0 (Class.java:-2) java.lang.Class.forName (Class.java:348) clojure.lang.RT.classForName (RT.java:2207) clojure.lang.RT.classForName (RT.java:2216) clojure.lang.RT.loadClassForName (RT.java:2235) clojure.lang.RT.load (RT.java:453) clojure.lang.RT.load (RT.java:428) clojure.core/load/fn--6824 (core.clj:6126) clojure.core/load (core.clj:6125) clojure.core/load (core.clj:6109) shadow-cljs - server version: 2.11.11 running at http://localhost:9630
https://clojars.org/thheller/shadow-cljs
@ps Specifying org.clojure/clojurescript 1.10.773
might help
shadow-cljs version specifies clojurescript version so I think you need to keep it the same
it works now
I’m getting an error when importing and using AsyncStorage
“error is ” #object[TypeError TypeError: undefined is not an object (evaluating ‘shadow.js.shim.module$$react_native_async_storage$async_storage.AsyncStorage.setItem’)]
using
(reg-event-fx
:_id-persist
(fn [coeffects [_ id]]
(go
(try
(<p! (. AsyncStorage setItem "_id" id))
(catch js/Error e (prn "error is " e))))
{}
))
importing
["@react-native-async-storage/async-storage" :refer (AsyncStorage)]
why is AsyncStorage undefined?
@ps it might be :as AsyncStorage
not :refer
, or even :default AsyncStorage
. see the translation table here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
import { AsyncStorage } from “react-native”;
which translates to what i have
actually import AsyncStorage from ‘@react-native-async-storage/async-storage’;
thanks
@thheller I’m running a watch process, running a build hook which finds functions with specific metadata and outputs a file because of it. When I add a new cljs file, I want that to be included in the watch/analyse/compile process. Is there a way to tell shadow to start watching this new file as well? If not, is there a way extend shadow user side to do this?
Also, is there a way to tell shadow to safely bail, in a build hook? Or should I just throw an exception?
to my first question: I want to watch all files against a specific path, and have them considered by the analyzer
@mail024 none of the default :target
implementations support this. what exactly do those files do? usually only files that are actually required by something will be included.
It’s really only in development that I want this. I’m doing something similar to what you do here https://github.com/thheller/next-cljs/blob/master/src/main/shadow/next_js.clj#L12. I got around this by watching the files myself and generating a “dev.cljs” file that contains requires for the files. This is good enough. But knowing how to include all files rather then just those reachable via entries would be useful for simplification of the implementation. Not vital given the workaround