This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-31
Channels
- # announcements (1)
- # babashka (27)
- # beginners (33)
- # cider (22)
- # clj-kondo (1)
- # cljdoc (2)
- # cljs-dev (8)
- # clojure (96)
- # clojure-australia (7)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-taiwan (1)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (23)
- # clojureverse-ops (1)
- # conjure (11)
- # cursive (29)
- # datahike (1)
- # datascript (8)
- # datomic (4)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (3)
- # helix (7)
- # jobs (4)
- # lsp (6)
- # malli (3)
- # off-topic (35)
- # pathom (6)
- # re-frame (4)
- # releases (1)
- # sci (18)
- # shadow-cljs (14)
- # sql (1)
- # tools-deps (11)
- # xtdb (6)
hi! how do I require (using require
, not :require
) some lib that has a leading @
in its name? this works
(ns hello-bundler.core (:require ["@urql/core" :as urql]))
but how could I use a function to do the same thing?
I want to do both 🙂 REPL for experimentation, then once I get what I want I write it to a .cljs file
And that's exactly what I'm concerned about. No idea about Webpack in particular but AFAIK you can't make require
work in a not self-hosted environment outside of REPL.
You can still have somewhat dynamic requires with module splitting. And I think you can have proper dynamic requires but with some other tools and not the default require
. But I've never done that so can't comment.
oh, no, I want to use require as a function for REPL-driven development, and stick to :requires in ns forms for compilation. seems alright, right?
Defining a macro like
(defmacro hmm [fun]
`((var ~(symbol fun))))
seems to work as expected in a clojure repl, but not in clojurescript?I suspect this is because of the last item here: https://www.clojurescript.org/about/differences#_vars_and_the_global_environment
Hi I’m working on a small project using react native, react navigation, reagent, re-frame, and krell. I’m having trouble getting my code to run with advanced optimizations turned on: one of the functions I call seems to get renamed. I’m using a global atom to get access to the root navigation object of react-navigation (the atom is set by react-navigation using a callback I provided). When I try to use this object, I get problems:
(.dispatch navigation (.replace StackActions "Home"))
navigation
is the value from the atom and .dispatch
is the problematic method.
This is the error message I get:
TypeError: hc($s).Zf is not a function. (In 'hc($s).Zf(_$$_REQUIRE(_dependencyMap[2], "@react-navigation/native").StackActions.replace("Home"))', 'hc($s).Zf' is undefined)
When I manually edit the generated code and replace .Zf
with .dispatch
, the program works as expected.
So my question is: how can I prevent that this function call is being renamed?Let me provide a little more context:
(let [navigation @!navigation]
(.dispatch navigation (.replace StackActions "Home")))
Should I add ^js
like this? (let [^js navigation @!navigation]
?Hey @dnolen is there any way to view the recent talk you did https://2021.phillyemergingtech.com/talks/clojurescript-in-the-age-of-typescript/ ?
Ah thanks @U2FRKM4TW!