This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-17
Channels
- # aleph (7)
- # announcements (1)
- # aws (12)
- # beginners (118)
- # calva (15)
- # cider (17)
- # clj-kondo (1)
- # cljdoc (11)
- # cljsrn (1)
- # clojure (108)
- # clojure-dev (32)
- # clojure-europe (3)
- # clojure-italy (4)
- # clojure-kc (1)
- # clojure-nl (4)
- # clojure-portugal (1)
- # clojure-spec (29)
- # clojure-uk (69)
- # clojurescript (91)
- # cursive (14)
- # datomic (8)
- # emacs (13)
- # figwheel-main (12)
- # graphql (4)
- # jackdaw (1)
- # jobs (14)
- # lambdaisland (3)
- # luminus (3)
- # nyc (1)
- # off-topic (14)
- # onyx (23)
- # pedestal (8)
- # re-frame (4)
- # reitit (3)
- # shadow-cljs (6)
- # spacemacs (7)
- # specter (2)
- # tools-deps (3)
- # unrepl (4)
- # vim (7)
- # xtdb (10)
@its.ramzi If I were you I would write a document with more details, like the purpose, whether or not it's open source, etc
cf. this issue: https://github.com/weavejester/hiccup/issues/161#issuecomment-512006631
Hi there. Just wondering why when I go to build a project (quick start) it sees code that is COMMENTED OUT.
Answer: In addition to the core.cljs file in the source folder, I also had a older version name core__V3,1[etc].cljs, and for some reason I guess the build was picking up that file instead of the core.cljs file. Strange.
@factorhengineering It will just compile all the files. 'Strange' is not something the compiler knows about.
@cjmurphy Compiling all files present makes so much more sense that selecting one and the 'wrong' one at that. Thanks.
I saw no sign of it having used two completely separate and similar files, though. I'm surprised there were no errors or noticeable odd behaviour with two things trying to manipulate the DOM in different ways. I guess I just blinked through the effects of the 1st and saw the effects of the 2nd.
I commented out (enable-console-print!), but the println commands littered throughout my code still work and go to the console!
looking at the source of enable-console-print!
, you could probably call (set-print-fn! nil)
and (set-print-err-fn! nil)
manually
npx shadow-cljs cljs-repl main
works for me, where main is a build defined in shadow-cljs.edn
No, but I think you need to kill whatever is running at 9631, which is most likely left around from last time you started 'it' up.
are you using emacs with cider?
Hi, I'm hitting an invalid arity error using apply
with more than 21 args here: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L2054
The function I'm applying to is a library function so I don't have control over wether it has attached metadata. Given that I'm a Clojure newbie, after a quick eyeball of that function, doesn't that rest
arg need to be a var-arg (`... & rest`)
Though I notice that the protocol https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L563 is also done without a var-arg so maybe this is intentional for reasons that I do not understand.
Do I need to manually chunk the args in 21 sized pieces in order to use apply
?
Is there a way to reuse fspec in clojurscript? the only way to spec functions in clojurescript seems to use fdef but that can’t take fspec defined somewhere else as an argument. My goal is to define a function spec in one place and re-use it for all functions that have the same function spec. This can be done in clojure the following way (I believe):
(def n->n-fn-spec (s/fspec :args (s/cat :n number?) :ret number?))
(s/def add5 n->n-fn-spec)
(defn add5 [n] (+ n 5))
(s/def add6 n->n-fn-spec)
(defn add6 [n] (+ n 6))
Looking at clojurescript fdef code (https://github.com/clojure/clojurescript/blob/230e46aee2c9b76e426e85865ab8930c4c26e14f/src/main/cljs/cljs/spec/alpha.cljc#L443) it adds the fn-sym to specedvars atom that is used with instrument. This is not the case in the clojure spec code where (I believe) the example I pasted above works with instrument
Would be curious to read a few more perspectives on this: https://clojureverse.org/t/how-do-you-store-entities-on-the-client/4525
hi guys i am having trouble doing advanced compilation for my project
I am using https://github.com/cljsjs/packages/tree/master/semantic-ui-react
and i am able to compile it with :simple
optimization but when i put :advanced
i get
TypeError: c.vd is not a function
I feel like i am missing some compiler option in order to make :advanced
work.
The jar comes with deps.edn
that have :foreign-lib
description in it i am not sure what to do?
How would you approach this?
i wouldn't want to use shadow-cljs just yet as i want to understand compiler more and not get stuck in the future on this
I am using clj cli
, deps
and figwheel main
template
this is my prod.cljs.edn
{:main routes.core
:output-to "resources/public/cljs-out/dev-main.js"
:output-dir "resources/public/cljs-out/out"
:asset-path "cljs-out/out"
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false
:infer-externs true
:closure-warnings
{:externs-validation :off :non-standard-jsdoc :off}
:externs ["react/externs/react.js"]}
Probably externs cannot be inferred for all the calls you're making from your code to foreign-libs. Try adding this on top of one of the namespaces where you're doing interop and see if you get any warnings (set! *warn-on-infer* true)
You can also set :pseudo-names
compiler option to true
to see more clearly which part of your code is failing with advanced optimizations
totally new to cljs, I am following a tutorial <https://clojurescript.org/guides/quick-start>, running the command in a remove server w/o X11, after I compiled by running
clj --main cljs.main --compile hello-world.core --repl
I was able to load the page with GUI browser locally using the IP address. In the console, it also said there was an option to turn off launching browser by passing REPL option
:launch-browser false, but where and how shall I config this option?I without passing the :launch-browser false option, I am not able to get to the REPL or see the Hello World output. Please help
in the clojure impl (not sure about cljs) s/fdef is just an s/def where the key in the registry is a symbol, instead of a keyword
@dnolen thanks! But I tried the following
clj --main cljs.main --compile hello-world.core --repl -ro {:launch-browser false}
it did not work. I tried to find out what "edn string" was (as suggested by the --help output).@alexmiller thanks that's helpful
Here is what I tried: none of them worked. clj --main cljs.main -ro ":launch-browser false" --compile hello-world.core --repl clj --main cljs.main -ro {:launch-browser "false"} --compile hello-world.core --repl clj --main cljs.main -ro {":launch-browser false"} --compile hello-world.core --repl
clj --main cljs.main -ro {:launch-browser false} --compile hello-world.core --repl Execution error at cljs.cli/repl-env-opts-opt (cli.clj:229). EOF while reading Full report at:
Oh yeah, this time it did not give me error, also the page loaded but on the remote server where the command was runnng, it did not return me a REPL. also there was no "hello world" printed out.
This is what I ran on the Ubuntu server:
clj --main cljs.main -ro "{:launch-browser false}" --compile hello-world.core --repl
it has been just hanging on the terminal "Waiting for browser to connect to http://localhost:9000 ..."
I even tried using text terminal on remote server to connect to localhost:9000, which loads the HTML successfully, but still no REPL for me.
@prodt90 we don't test with a remote server so who knows what issues are involved here - did you try locally?
Anyone here using Tsickle (https://github.com/angular/tsickle) to get better Closure advanced compilation for JS dependencies?
@dnolen I tried to use a server to run the command clj --main cljs.main -ro "{:launch-browser false}" --compile hello-world.core --repl It did not return Hello World, unless I open a GUI browser on the same machine, Waiting for browser to connect to http://localhost:9000 ... Hello World! ClojureScript 1.10.516 cljs.user=> (+ 3 5)
I.e., a text browser failed to trigger opening the REPL, . Those seemed to me at lease two bugs involved.
I am simply trying to follow the simpliest tutorial in the world to learn cljs tihs afternoon.
To keep things simple, probably best to use the most normal setup that cljs was intended for. That wouldn't be remote servers and text browsers. It'd be Chrome or FF on a normal PC with a GUI.
I expect the command I run would say hello world and give me a repl, if I use :launch-brower false.
Clojurescript needs a javascript VM in order to run and do anything. Commonly that JSVM is in a (normal modern) browser. I think it can also be done via Node.js. But you might need to follow instructions or a tutorial that's meant specifically for that.
ok. thanks for the tips, yeah, that is very helpful. the problem I met is actually no big deal, I need to keep things simple like you said.
Anyone know if it’s possible to get a handle to the com.google.javascript.jscomp.CompilerOptions
object at compile-time?