This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-11
Channels
- # announcements (15)
- # babashka (13)
- # babashka-sci-dev (2)
- # beginners (80)
- # clerk (11)
- # clj-commons (4)
- # cljs-dev (1)
- # cljsrn (1)
- # clojars (19)
- # clojure (48)
- # clojure-austin (2)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (26)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-hungary (32)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # community-development (7)
- # datomic (15)
- # emacs (6)
- # fulcro (2)
- # gratitude (1)
- # hoplon (3)
- # hyperfiddle (28)
- # inf-clojure (14)
- # introduce-yourself (1)
- # jobs (1)
- # joyride (4)
- # lsp (50)
- # malli (4)
- # nrepl (2)
- # polylith (12)
- # shadow-cljs (27)
- # spacemacs (3)
- # sql (8)
- # tools-build (11)
- # xtdb (22)
Hello everyone! I tried to set up a new project with shadlow-cljs and react-native but get an error when launching the app on Android (iOS not tested): Property 'setTimeout' doesn't exist
Also when trying to connect via nrepl I get No available JS runtime.
Obviously there is something not set up correctly.
;; shadow-cljs configuration
{:deps {:aliases [:app]}
:dependencies []
:builds {:app {:target :react-native
:init-fn
:output-dir "react-native/app"
;:asset-path "images"
:compiler-options {:infer-externs :auto
:output-feature-set :es5}
:js-options {:js-package-dirs ["react-native/node_modules"]}
:devtools {:preloads [shadow.remote.runtime.cljs.browser]}
}}
:nrepl {:port 9876}
}
no clue if thats even supposed to be available in RN. they changed the default engine to hermes not too long ago. dunno if thats available there
ReferenceError: Property 'set Timeout' doesn't exist
at global ()
at eval (native
at anonymous (: 8081/index.bundle? platform=android&dev=true&minify=false&app=com
In gradle.properties
I set hermesEnabled=false
and now I get: Can't find variable: setTimeout
yeah sorry, no clue. I don't have a working react native setup so I can't test myself
Can't find variable: setTimeout
Can't find variable: setTimeout
eval code eval@ native code]
false&runModule=true:1601:14
false&runModule=true:2662:22
@thheller the error was caused by not having react-native
imported due to incomplete code or premature compilation 🙈 Sorry. Works with Hermes and the latests deps.
Hi everyone,
I'm choosing this channel for my question, as there seems to not be one dedicated to clojure cli/deps.edn yet and it is about integrating it with shadow-cljs.
I use CIDER for Clojurescript coding. Until now, I used to run shadow-cljs directly, outside of Emacs, then connecting to it. To inject the correct middleware I have the following in my global ~/.shadow-cljs/config.edn
:
{:dependencies
[[cider/cider-nrepl "0.28.5"]
[refactor-nrepl/refactor-nrepl "3.6.0"]
[cider/piggieback "0.5.2"]]}
I have now tweaked a project to use deps.edn in conjuction with shadow-cljs, which I now start with clj -M:shadow-cljs watch server
. The corresponding alias definition in the project-local deps.edn looks as follows:
{:shadow-cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.18.0"}
cider/cider-nrepl {:mvn/version "0.28.5"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}
cider/piggieback {:mvn/version "0.5.2"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}}
This works fine, but I would very much prefer to pin the middleware versions globally, since they are needed by my editor, not by the project per se: After all, other team members might be using different versions of CIDER and the respective middleware. I know I could make the entire alias available globally by moving it to ~/.clojure/deps.edn
, but that would include the version of shadow-cljs as well. That version, however, is project-specific, so it should be specified locally inside the project. The same would also apply for dev-only dependencies like Re-frame-10x etc.
The way vanilla shadow-cljs merges configurations was sufficiently fine-grained to allow for dev-only-dependencies coming from local and global configs at the same time. This seems to not be the case with deps.edn. E.g. it doesn't work to have the following in ~/.clojure/deps.edn
:
{:aliases {:shadow-cljs {:extra-deps {cider/cider-nrepl {:mvn/version "0.28.5"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}
cider/piggieback {:mvn/version "0.5.2"}}}
}}
and reduce the alias in my project's deps.edn
to
:aliases {:shadow-cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.18.0"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}}
Apparently, these aliases are not merged and there is no CIDER middleware in the nrepl started. Is there any recipe to achieve the merging of :extra-deps
from global and local deps.edn files?
Many thanks for any insights you may give me!@thheller That does indeed work, Thanks a lot. I wasn't aware of the possibility to activate more than one alias like that… after all, this was my first exposure to deps.edn. Thanks again for taking the time to address this and for making shadow-cljs the joy it is!
Am I mistaken that simple optimizations should not mangle names? If I compile with just npx shadow-cljs compile app
everything works great but when I use npx shadow-cljs release app
with optimizations set to simple I get reference errors in the console
it does rename some things, but not properties on objects. only locals and stuff usually which shjouldn't break things
Is there gonna be a notable difference between using compile
and release
if I'm just compiling a single small module? I'm guessing not and will probably leave it.