This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-13
Channels
- # bangalore-clj (1)
- # beginners (40)
- # boot (22)
- # clara (19)
- # cljs-dev (265)
- # clojure (160)
- # clojure-dev (6)
- # clojure-italy (5)
- # clojure-russia (47)
- # clojure-spec (10)
- # clojure-uk (63)
- # clojurescript (88)
- # core-async (8)
- # cursive (54)
- # datomic (48)
- # emacs (32)
- # garden (3)
- # graphql (29)
- # hoplon (54)
- # jobs (1)
- # klipse (4)
- # luminus (5)
- # lumo (21)
- # mount (5)
- # off-topic (16)
- # om (2)
- # pedestal (10)
- # play-clj (1)
- # portkey (32)
- # re-frame (21)
- # reagent (48)
- # rum (1)
- # spacemacs (4)
- # sql (3)
- # unrepl (5)
I posted my complaints in beginner channel but I wanted to ask here since someone here has run into this issue. How did you work around fetching data from a server that doesn't support CORS?
mostly what you suggested, doing the request from my own app backend - it makes things much simpler
@thheller thanks for your input on https://dev.clojure.org/jira/browse/CLJS-2216
is it possible with shadow-cljs to use a different :optimizations
for different modules?
so i’ve been pointing https://github.com/danvk/source-map-explorer at our advanced-mode js. it only shows the stuff that the cljs compiler produces, because it’s looking at the source maps. is it possible to also bring in source maps for all the preamble cljsjs deps, so that they can also be visualised in the same diagram?
@robert-stuttaford cljsjs foreign-libs, probably not, but it should be possible to include Closure modules (`goog.*`, processed JS modules etc.) in source-map
Possible, as in, it will need work on ClojureScript compiler to support this
that’s what i thought, thanks @juhoteperi ! so goog.* already shows in this map, btw. perhaps happy magical things happen once the new npm goodies land
Huh, I was looking at source-map-explorer and didn't see goog.* modules
Does boot-reload mantain state like figwheel does? If not, is there another plugin that would add that feature?
@benbot Hey ben, the short answer is yes. The long answer is neither actually maintains state. Usually your state is gonna be in an atom defined with defonce
which prevents re-defining it. It is not that these tools maintain state, it is that the way we code apps lends itself to hot code reload pretty well.
Okay cool, I knew that to keep that state you needed to put it in an atom, I just wasn’t sure if boot-reload would reset the atom or not
also a dirty trick one can use is (defonce foo (init-state))
so that your initialisation code is called just once
lol I czn understand that, boot is pretty cool. There is a boot channel if you wanna check it out.
Anyone else having periodic failures downloading the clojurescript-1.9.671 jar from clojars? I am getting sporadic build failures that seem to be caused by this
lein deps
gives me:
>Could not transfer artifact org.clojure:clojurescript:jar:1.9.671 from/to central (https://repo1.maven.org/maven2/): Read timed out
>Could not find artifact org.clojure:clojurescript:jar:1.9.671 in clojars (https://clojars.org/repo/)
Hmm, maybe network issues from circleci or something, everything looks hunky-dory from here. 🤷
@timgilbert I thought Clojurescript is distributed via maven central
Ah yeah, but I guess it can’t download from central, and then it can’t find it on clojars, these errors make sense 😄
Yeah. I'm guessing it's a circleci network issue or maybe a bad mirror in maven or something. I have a support ticket in to circleci.
Does the new feature rely on npm to install the packages locally (I assume there's no built in npm compatible client)?
@robert-stuttaford just a thought: not really important to have those show because there's really nothing you can do to slim them down
Even though it's a bummer because source map explorer can't tell you the actual size of your bundle
As Juho said, I also didn't see goog things in my bundle. Would be interested if you could share a viz where they appear
@pandeiro :npm-deps
will shell out to NPM
@anmonteiro Thanks, and does it depend on npm for anything else, such as the Babel transforms, or is that handled inside the Closure compiler?
The beautiful thing about preprocessing is you can write them yourself :-)
Post still to come
@pandeiro which means you can to module preprocessing in nashorn, rhino, shell out to node, you name it
@anmonteiro seeing it is valuable; one might decide to drop a dep entirely 🙂 the three we did of various cljs apps (not libraries) all had small bits of goog.* in them
Hi all, what is the proper way to map values into a select fields options? This (map #[:option {:value %} %] (SongTitles))
gets me a Reader tag must be a symbol
error and can’t seem to figure out how to get it. (SongTitles)
returns a list of Strings. thx!
@fedreg replace #
with (fn [x] [:option ...])
@anmonteiro Ahh, thx! I thought those were the same thing. Does not work with []
?
the syntax for an anonymous function is #( ...)
to return a vector from an anonymous function you’d have to do: #(do [:option ...])
in Lumo:
cljs.user=> (macroexpand '#(do [:option {:value %}]))
(fn* [p1__3#] (do [:option {:value p1__3#}]))
cljs.user=>
@fedreg without the do
it’ll try to call the vector. see the expansion:
cljs.user=> (macroexpand '#([:option {:value %}]))
(fn* [p1__6#] ([:option {:value p1__6#}]))
cljs.user=>
hello everyone, sorry for the dumb question, but i cant find the solution in google how im supposed to disable a input using hiccup?
<input type=“text” name=“lname” disabled> if id translate this to a map, it wouldnt have an even number of elements
in reagent it's {:disabled true}
Hm. I wonder why Slack considers the file to be binary.
so if I understand correctly, javascript libraries are just prepended to compiled result and dead code optimization doesn't work on them?
i suspect the answer is: it depends. 😉 there are js libs, and then there are js libs.
see https://clojurescript.org/reference/dependencies but also https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules which is new.
the "not an island" blog article dnolen posted the other day says: "ClojureScript is now smart enough to find these CommonJS modules and process them into Google Closure Compiler compatible code." does this mean that js code will be closure-optimized even if it is not written to closure's restrictions (https://developers.google.com/closure/compiler/docs/limitations)?
as stated elsewhere there are caveats - but for many modern style JS libs this likely won’t be an issue
also it encourages ClojureScript developers to reach out to critical libs and make whatever small tweaks are necessary to make them Closure compatible
the mind boggles. we can thank maria geller for (much of) this? i think we need a "Contributor of the Year" award.
so right now, I'm using Materials-UI and Om.next. Will this change mean I won't get whole React in my production build anymore if authors of those two libs changed their libraries to use node.js modules?
@mobileink yes she did the groundwork for many of these enhancements - there were lots of details to sort out later which is why it took so long to wrap up - and some things came by surprise and solved problems for us (Closure Node JS module resolution)
cool. wherever you are, maria geller, thank you bigly! there's a bottle of Malort with your name on it in Chicago.
What's Malort?
ok, stupid question time. Polymer uses bower. can cljs deal directly with bower stuff? i'm afraid i dunno a whole lot about such stuff.
oh it's a swedish liqueur
@mobileink we don’t integrate with Bower, and we’re probably not going to
@roklenarcic https://munchies.vice.com/en_us/article/78djmd/malicious-maligned-malort-is-chicagos-most-beloved-and-disgusting-liqueur
for everything else we have a new feature coming down the pipe which allows people to use externally built stuff in a completely idiomatic way
We encourage everyone to give master a try, we’re planning on releasing right before EuroClojure next week
building from source is pretty easy if you have Maven installed (easily done via your favorite package manager) https://clojurescript.org/community/building