This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-16
Channels
- # architecture (12)
- # aws (8)
- # bangalore-clj (1)
- # beginners (172)
- # boot (25)
- # chestnut (3)
- # cider (15)
- # cljsrn (5)
- # clojure (170)
- # clojure-india (1)
- # clojure-italy (21)
- # clojure-nl (87)
- # clojure-romania (3)
- # clojure-sg (1)
- # clojure-spec (1)
- # clojure-uk (79)
- # clojurescript (79)
- # cursive (2)
- # datomic (29)
- # dirac (26)
- # emacs (7)
- # fulcro (13)
- # jobs (4)
- # juxt (22)
- # lein-figwheel (1)
- # leiningen (2)
- # lumo (39)
- # nrepl (1)
- # off-topic (54)
- # onyx (124)
- # pedestal (1)
- # planck (4)
- # portkey (1)
- # re-frame (36)
- # reagent (2)
- # ring-swagger (8)
- # shadow-cljs (107)
- # spacemacs (1)
- # specter (25)
- # sql (7)
- # tools-deps (5)
- # vim (10)
- # yada (25)
any good examples of a project using figwheel with just cljs?
Interesting question. So you mean without something like re-frame. Just reloading namespaces etc.
There's not too much to configure or get wrong. I'd say start with the figwheel documentation and try the lein template.
Here you go https://github.com/tkjone/clojurescript-30/tree/master/03-drumkit/figwheel
very simple project: - latest CLJS - pure JS interop - latest figwheel - clj tool (replaces lein/boot for this project)
When I have time, all the projects in this repo will be converted to a similar setup...although, for how I want these projects to be used, I will likely just use the clj --watch
command and drop figwheel...otherwise, should be what you're looking for
Thanks, I am starting cljs with shadow-cljs, but would like to know some of the other ways outside of the lein/boot env for getting a project up. Very cool
is the document of npm-deps
has been removed from http://clojurescript.org?
@doglooksgood https://clojurescript.org/reference/compiler-options#npm-deps and https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules
@mfikes thanks, I think what i found is this: https://clojurescript.org/guides/javascript-modules#node-modules it's likely there're some pages about how to use javascript libraries.
is there a way in a Clojurescript project (using also re-frame and integrant) to load a namespace dynamically?
it works if I add a require in the cljs file (even if not on top) but not if I add inside a function
the problem is simply that we have a cljc
file with some specs that should always be loaded or funny things happen
I think the answer is simply "you can't", there's some info here regarding the (require
outside of ns
https://anmonteiro.com/2016/10/clojurescript-require-outside-ns/
anyway, if they need to be loaded, why can't you just require it in the ns
form?
yeah I think that's the real mistake, but it just contains specs and some not namespaced for some reason
(like :something/blah instead of ::blah)
@andrea.crotti FWIW, when you add a require in an ns
form, the order is honored. So if you need specs to be loaded before some other namespace, you can control that.
There is also this (I've never used it): https://clojurescript.org/reference/compiler-options#preloads
Hi, did anybody face troubles with an ##Inf
tag when compiling cljs? For example:
Parse error. primary expression expected
case ##Inf:
^
I’ve found some github/google topics so for, but none of them help. My clojure(script) deps are:
[org.clojure/clojurescript "1.9.908" :exclusions [org.clojure/tools.reader]]
[org.clojure/tools.reader "1.1.0"]
I also tried to use the latest clojuresctip complier but without any result.@igrishaev I'm not sure which version of clojurescript introduced ##Inf
, but that is worth checking 🙂
@igrishaev why are you changing the tools.reader
version manually?
@mikerod it was just another try. The original version of deps are:
[org.clojure/clojurescript "1.9.946"]
But still, it doesn’t work. I have a feeling that some legacy version of tools.reader might be used due to multiple dependencies.
this was a common issue that came up with ##Inf
was introduced though, probably can find some info out there
@igrishaev https://stackoverflow.com/questions/48039878/cljs-core-cljs-line-988-col-14-no-reader-function-for-tag-inf/48327231#48327231
@mfikes yes, I’ve been on that page. Do you know btw how to check what exact version of a library is used? I guess that something overrides tools.reader
The answer to that depends on which dependency management tool you are using. (`lein`, boot
, clojure
/ deps.edn
)
I'm trying to get :infer-externs
to correctly recognize the method .createToken
as an extern.
My code is
(defn- submit [stripe card token-callback]
(fn []
(-> ^Promise (.createToken ^js/Stripe.stripe stripe card)
(.then (fn [^js/Stripe.result result]
(let [msg (error-message result)]
(dispatch [::set-stripe-error msg])
(when-not msg (token-callback (.. result -token -id)))))))))
(set! *warn-on-infer* true)
doesn't warn about it with the type hint, but when I build I get the error TypeError: $stripe$$.$createToken$ is not a function
Any tips why type inference isn't working there?I got it working with a manual externs file, but I'll try master now to see if inference works there.
if you can’t get it to work then that’s another thing for me to tweak, I was just recently working on it so I can add a new test case
@vinai for ad-hoc clojurescript master testing with lein I usually delete particular version from ~/.m2
, then clone clojurescript repo, edit project.clj there to match my version (`1.10.238` in your case) and do lein install
, this should put clojurescript master in place of 1.10.238 on your machine.
why not just edit the project.clj to a unique value (1.10.238.mine-1)?
no, lein install
in clojuescript repo will build clojurescript and install it locally into m2
then use that value instead
m2 repos should be like immutable y’know? ;)
@alexmiller yes, that’s a better solution, but one more step 🙂
until you mess it up and lose a day debugging it
let me try that - will be quicker than building up the deps.edn (even though I'm 1/3 done with that).
(this is how I sometimes test local clojure builds btw)
you can actually do even better if you’re doing deps.edn though
by making an alias that uses :classpath-overrides to swap out the mvn jar for own local one
{:aliases :dbg {:classpath-overrides "path/to/clojurescript.jar"}}
if you always do your local build in the same place then you can put this in your ~/.clojure/deps.edn instead and then anytime you want to test with a local build, you can -A:dbg with 0 steps
Creating ~/.m2/repository/org/clojure/clojurescript/1.10.238-mine.1
worked fine, but when I try to build my project I get an java.lang.IllegalArgumentException: Not a file: jar:file:/Users/vinai/.m2/repository/org/clojure/clojurescript/1.10.238-mine.1/clojurescript-1.10.238-mine.1.jar!/cljs/util.cljc
The file /Users/vinai/.m2/repository/org/clojure/clojurescript/1.10.238-mine.1/clojurescript-1.10.238-mine.1.jar
does exist though.
does jar tf /Users/vinai/.m2/repository/org/clojure/clojurescript/1.10.238-mine.1/clojurescript-1.10.238-mine.1.jar | grep util
find util.cljc? maybe it’s not built right?
well, ya got me
% jar tf /Users/vinai/.m2/repository/org/clojure/clojurescript/1.10.238-mine.1/clojurescript-1.10.238-mine.1.jar | grep util
cljs/analyzer/utils.clj
cljs/util.cljc
Is infer-externs always enabled with when building with clj -m cljs.main --optimizations advanced
?