This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-03
Channels
- # babashka (17)
- # beginners (166)
- # calva (97)
- # cider (4)
- # clara (2)
- # clj-kondo (46)
- # cljsrn (5)
- # clojure (334)
- # clojure-canada (1)
- # clojure-dev (144)
- # clojure-europe (14)
- # clojure-germany (5)
- # clojure-nl (10)
- # clojure-spec (1)
- # clojure-uk (46)
- # clojurescript (50)
- # conjure (1)
- # core-async (52)
- # core-typed (5)
- # cursive (3)
- # datomic (3)
- # emacs (11)
- # figwheel (16)
- # figwheel-main (9)
- # fulcro (29)
- # graalvm (19)
- # graphql (14)
- # helix (46)
- # hoplon (4)
- # hugsql (2)
- # jobs (2)
- # jobs-discuss (1)
- # juxt (15)
- # kaocha (6)
- # off-topic (9)
- # pedestal (7)
- # portkey (7)
- # re-frame (10)
- # reagent (29)
- # shadow-cljs (13)
- # spacemacs (70)
- # sql (13)
- # tools-deps (26)
- # xtdb (23)
@bhauman or anyone else who might be interested, I figured it out, webpack config needs this: devtool: 'source-map'
to fix problem above
Source that was directly relevant and helped: https://github.com/aws-amplify/amplify-js/issues/5660
It affected around 10 of my NPM dependencies, out of about 30. Did not look into the characteristics of the ones that did not work, could do that if any of the core people are interested in solutions to this problem.
Hi yall,
Question: when my app is compiled, it seems to run in the window
scope. Is there a way to like wrap it in a Immediately Invoked Function Expression (IIFE) or similar?
because my cljs script is being embedded in websites beyond my control, this is why I ask.
Wait. This is probably it: https://clojurescript.org/reference/compiler-options#output-wrapper
is there a way to get the closure compiler to output a warning whenever it encounters a js property that isn't defined in an extern? is this even a good idea?
so, if you do a (.-foo x)
where x is typed / inferred value, and if foo
isn't defined in an extern, it'l let you know at compile time
in shadow-cljs there is shadow-cljs check the-build
but it generates very many false positives and a lot of noise so its not super useful. it does warn about all those cases though.
so generally not a good idea for CLJS. only really works if you have fully typed code like the closure-compiler prefers.
can't really do this without shadow-cljs. its not just a couple compiler options. shadow-cljs also feeds additional info to the closure-compiler. otherwise you'll end up with thousands of warnings for cljs.core alone
shadow-cljs basically just runs the closure-compiler with typechecking enabled (which usually isn't)
see what you mean about false positives.. loads of warnings for arity-1 parseInt
for example, which I'm not even sure is an error in the browser.. (the radix behaviour should be stable there..)
dunno, in my experience check
output is only useful as very last resort. externs inference usually catches most things already so that should be preferred
FWIW the parseInt for example SHOULD always have 10 as the second arg if you want to be safe
> An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. Be careful—this does not default to 10!
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
to give a concrete example, i'm upgrading a JS library that renamed a property that exposed a promise from complete
to done
- promises can be resolved with undefined just fine, so it wouldn't throw any kind of error as if we tried to invoke it as a function.
closure can't tell if its complete
or done
since it doesn't know the type of the value you are operating on
yeah closure doesn't see that. it just causes shadow-cljs to generate externs for foo
so, shadow will assume that the programmer has done the right thing, and generate an extern for the property foo
?
as soon as you add a ^js
hint it will be treated as such and collect externs for all property access yes
Any recommendations on HTTP client libraries compatible with both CLJ and CLJS? Or am I better off writing something that handles both on my own?
To answer my own question, https://funcool.github.io/httpurr/latest seems to be roughly what I was looking for — will give it a shot 🙂
Hi all, is possible to add an :after
style dynamically? I am using reagent and essentially, I have tried doing {:style {:after {… attrs …}}
Oh, it looks like it’s generally not possible. https://stackoverflow.com/questions/14141374/using-css-before-and-after-pseudo-elements-with-inline-css
@gekkostate you can toggle a CSS class which has the :after
style
Yes, that’s a good point. I will try this approach. Thanks!