This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-17
Channels
- # announcements (3)
- # babashka (41)
- # beginners (118)
- # calva (4)
- # cider (22)
- # clj-kondo (4)
- # clj-on-windows (1)
- # clj-together (1)
- # clojure (164)
- # clojure-europe (46)
- # clojure-filipino (1)
- # clojure-indonesia (1)
- # clojure-my (1)
- # clojure-nl (3)
- # clojure-sg (1)
- # clojure-spec (13)
- # clojure-uk (16)
- # clojurescript (18)
- # cloverage (3)
- # conjure (5)
- # core-async (8)
- # cursive (21)
- # datomic (4)
- # deps-new (15)
- # emacs (12)
- # expound (4)
- # fulcro (45)
- # graalvm (32)
- # jobs (1)
- # malli (5)
- # nextjournal (63)
- # off-topic (27)
- # other-languages (3)
- # pathom (27)
- # proletarian (1)
- # rdf (24)
- # re-frame (10)
- # reagent (9)
- # releases (2)
- # shadow-cljs (72)
- # spacemacs (4)
- # timbre (4)
- # tools-deps (29)
- # xtdb (4)
@thheller Hi. I submitted a PR for reagent-expo
yesterday to upgrade it to work with Expo SDK 44 and EAS Build. I also added a way to block Expo Web’s fast refresh and removed that section from the README. If you have a chance to check it, please let me know if I need to change anything 🙂
https://github.com/thheller/reagent-expo/pull/10
It’s Expo’s new way of building which allows you to incorporate custom native code. The old way of building is currently still supported, but will be going away at some point. EAS Build allows you to continue using the Expo Managed workflow, and still install dependencies that you would previously have had to eject for. You can also build plain React Native apps using EAS Build.
I don't follow Expo at all so I don't have any way of checking your PR. I'm fine with merging it if you accept that I direct people asking questions your way 😉
hehe 🙂 you can point them at http://forums.expo.dev and there’s a good chance I will see there question and answer them there.
I understand if you don’t want to bother, but it’s really easy to try it out:
• Create an Expo account (I think you might have done this in the past)
• npm i -g expo-cli eas-cli # there’s a weird yarn bug that sometimes happens when installing these globally with yarn
• clone the reagent-expo
repo
• run yarn
to install the dependencies
The development instructions are unchanged.
The instructions for building a standalone app that you can submit to the App/Play stores is now just basically “run eas build ...
” because npx shadow-cljs release app
is run as part of the build.
So for example you can run:
eas build --platform=android --profile=preview
which will build a .apk that you can install on an Android device. The first time you do this it will ask for the Android package
(which is normally something like io.github.shadowcljs.reagentexpo
(Android doesn’t like dashes there for some reason)). If you build for iOS then it will ask for a bundleIdentifier
which is basically the same thing for iOS (but dashes are allowed there.) It will also generate a default eas.json
config file.
yeah sorry I'm not gonna do any of that. way too swamped already and no time to look into what looks like an entire new ecosystem
I understand.
Yes, I did not change anything about shadow-cljs (except upgrading the version).
The changes were just Expo-related and documentation.
I think my PR is useful for people following the link from the Expo section of the Shadow CLJS docs. I’ve pretended that the “classic” build system doesn’t exist for two reasons:
1. The original reagent-expo
README basically said :man-shrugging:
2. The classic build system will be going away at some point
I will attempt to answer questions people have if you direct them to the Expo forums
Thanks for your time and for Shadow CLJS 🙂
Is it possible to control the :asset-path
dynamically? Via e.g. setting a top-level JS var on window
? I'm dealing with a convoluted setup that must have the asset path being an absolute URL, even in development, e.g. doing :asset-path "
, which works fine, but then I'd like to also test on my phone which means that localhost won't do.
did you maybe try using the proxy support? https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http-proxy
What about calling manually shadow.loader.init
? It seems to be working in my setup. My generated HTML file is doing roughly
<script src={base-module}>
<script src={main-module}>
<script>shadow.loader.init("")</script>
It seems to be working but ideally I should probably put shadow.loader.init
after the base module? As, at the time main-module gets loaded, React begins to render so it may trigger asynchronous loading...
so best in a init method as described here https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html
The issue with the init
method is that it doesn't accept any arguments, so I have to append an extra script tag in my index.html to do this kind of dynamic thing.
I could bypass the init-fn entirely and just call my init-fn after I setup the shadow.loader
so for example you can include a <meta name="my-base-path" value="whatever">
in your html
Right, I can figure that out in multiple ways - I was wondering about that you said about asset-path being used in other places too though?
source maps mostly. if you don't get any warnings/errors regarding those it most likely is fine
Ah right, that's a production concern. In production I hardcode an absolute path for the asset-path. It's only in dev mode that I need to have it dynamic.
dunno what you are doing so can't comment much. normally proxies make all uses of weird server setups unnecessary
so any webserver can serve them. no need to have any built-in shadow-cljs server serve them
It's the module loader that is out of my control, otherwise loading the base files works just fine.
(But it turns out I can init the module loader just fine, so I'm happy. Problem solved 🙂
Hi @thheller, I'm having to work with a native, buggy Javascript code (again!) and somehow Shadow/CLJS is behaving strangely. From what I could get, some namespaces simply change to undefined
and I can't call function on them anymore - I start the "watch" process, connect my Javascript app, but as soon as it tries to run anything that's on the ClojureScript side, it simply fails with TypeError: Cannot read property 'after_load' of undefined
for example (`after-load` is a function defined on CLJS side). I found out that if, just after I connect to the JS app, I reload a specific namespace (by saving the file) then things work. Is there a way to either debug this issue, or force-reload of this namespace all the time?
On this example above, the error was triggered from:
(defn ^:dev/after-load after-load []
(println "Reloaded!"))
(defn start []
;; ..setup here..
(p/do! ;; promesa
(p/delay 2000) ;; wait 2s
(after-load)))
RIGHT you are again! I just searched for the old codebase, and it indeed replaces LOTs of global objects - one with the same exact name as my namespace. Thanks again!
Reading the docs but did not find any hints: Is it possible to swap out the version of clojurescript shadow uses? There's some 1.11 features I would like to try
what are you looking for in particular. As far as I know there have been zero changes in 1.11.4 that affect shadow-cljs
https://clojure.atlassian.net/browse/CLJ-2603 the feature that applies the last map in function calls to keyword args caught my eye. Checked out the shadow-cljs repo and seems it's pinned to 1.10?
anyways. if you are using deps.edn or project.clj you can use any cljs release you want
https://github.com/clojure/clojurescript/commit/c260cea7b03b223d6262ddd6e8c1f7346b92e965
> anyways. if you are using deps.edn or project.clj you can use any cljs release you want That's what I was looking for. Thanks once again! Would you be open to a PR against the docs to mention that?
just didn't this time since there have been no changes in the 1.11.4 release that added any new features or did anything else that would affect shadow-cljs users
Fair enough. May not be worth mentioning then, though I guess it comes down to what you find more annoying: Questions like this or people reporting issues using an incompatible version of cljs 😆