This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-26
Channels
- # beginners (20)
- # cider (59)
- # cljsrn (6)
- # clojars (7)
- # clojure (91)
- # clojure-boston (1)
- # clojure-dusseldorf (3)
- # clojure-finland (1)
- # clojure-italy (8)
- # clojure-losangeles (1)
- # clojure-nl (16)
- # clojure-spec (25)
- # clojure-uk (113)
- # clojurescript (126)
- # core-async (27)
- # cursive (5)
- # data-science (3)
- # datomic (22)
- # emacs (24)
- # fulcro (30)
- # garden (7)
- # graphql (7)
- # leiningen (3)
- # nginx (1)
- # off-topic (63)
- # onyx (13)
- # portkey (1)
- # re-frame (1)
- # reagent (28)
- # shadow-cljs (92)
- # tools-deps (1)
- # uncomplicate (1)
- # vim (24)
- # yada (8)
Hi folks, I'm replicating https://github.com/shadow-cljs/expo-test and want to make sure I am on the right page. I'm able to get the DemoApp running in the Expo app on my iOS device, but it displays (and live-reloads) text from the JavaScript source rather than what I see in the ClojureScript source ("Hello World from CLJS! 1"). Is this expected?
@daveliepmann not sure I understand what you mean? which javascript source?
App.js
at expo-test/DemoApp/App.js
I don't believe I'm running the react-native things, because I didn't run any of the printed instructions
(I did the first time I went thru the README, but have stopped them and restarted my machine since then)
I think I've cleared the cache successfully and am experiencing the same issue. I now suspect it could be that I was unable to download a version of the iOS app that supports QR codes, so I am loading the app on iOS thru the Expo desktop app.
trying now with manually sending link
right
investigating
no worries, thanks for the quick response
Can I get shadow-cljs to generate a handler function for use with AWS Lambda? When configuring a Lambda function on AWS, I can specify a handler like myFile.myHandler
, which magically makes AWS look for exports.myHandler
in myFile.js
.
@grav :node-library
does this. :exports {:myHandler your.ns/handler}
. so it is basically exports.myHandler = your.ns.handler
;
I tried adding something like the last statement directly to the generated js, but it didn’t work. I’ll use the :exports
way
you'll need to use release
builds with AWS though. it probably wont unterstand the dev stuff
hi! sorry, completely new user here. Just tried to do this:
(ns live.client.components
(:require
[reagent.core :as r]
#?@(:node [[filemporium.ssr.http-client :as client]]
:cljs [[live.client.subscriptions :as sub]])
))
and I get The required namespace "live.client.components" is not available, it was required by "filemporium/client/live.cljs".
without reader conditionals compilation seem to work fine, i.e. I get warnings from this namespace
@zarkone Two things about reader conditionals
- I’m pretty sure the @
shouldn’t be there scratch that
- I’ve never seen :node
before and can’t find it documented. I’m not sure you can discern on compile-time? On run-time you could ask if some node-specific api exists
also, @
is for splicing here, taken from https://groups.google.com/forum/#!topic/clojure-dev/8YJJM8lJuQs
The required namespace "live.client.components" is not available
happens when the compiler failed to parse the ns
form
np. I think the feature isn't properly documented at all yet since Core is kinda against it and declined the feature request
sorry, Core of what? you mean that we can't extend reader conditionals on plain clj/cljs ?
https://dev.clojure.org/jira/browse/CLJS-2396 this was declined
yes, I think I've came across this earlier. I actually think that yes, clj/cljs "isomorphic" compilation is usefull, but node/browser/etc separation is mandatory, i.e. more important.. so not sure why this was declined 😞
I was even thinking about switch back to cljx
before I knew about shadow-cljs
. thank you very much!
@thheller not sure the new output-wrapper is working, still getting no wrapping even in 1-module builds
@kanwei didn't make a new release yet. its only in master for now. probably make a new release in a bit. just got home.
The ES6 Import to CLJS Require table (https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages) has been helpful but I can't seem to get a particular package to work, and my knowledge of JS packages is quite limited. I am trying to use react-countup (https://github.com/glennreyes/react-countup#usage). I have added react-countup "3.0.3" to my package.json and npm install
'ed. I have ["react-countup" :as countup]
required in my ns
. countup/CountUp
is undefined though. If I look at the countup
object itself, I can see a few functions defined: formatNumber
and startAnimation
but not the class: https://github.com/glennreyes/react-countup/blob/master/src/index.js#L105. I must be missing something simple here.
Ah, I believe because their import is import CountUp from 'react-countup';
, I do not need to do countup/CountUp
. It should just be available under countup
.
A closer reading of the bits below the table yields the answer 🙂 It's actually this:
(:require ["react-countup" :as countup])
;; this is the React component
countup/default
@kanwei just pushed 2.3.9
which has :output-wrapper
. also documented it here: https://shadow-cljs.github.io/docs/UsersGuide.html#output-wrapper
@kenny (:require ["react-countup" :default CountUp])
would be the translation of import CountUp from 'react-countup';
Right, but I don't really like the whole :refer
-esque approach. I much prefer to use aliases.
true but be aware that the default import/export in ES6 has special meaning and might not always be /default
in the future.
The default thing seems silly to me. It saves two whole characters when import
'ing. Perhaps I don't fully understand the advantage of it.
in ES6 the default export is technically a standalone variable. it is not part of the object you would get with :as
. The .default
property only exists to make things compatible with CommonJS require
. strict
ES6 does not have this.
Is there a way to rename it? I was hoping to name my Reagent component CountUp as well.
be aware that standard ES6 still has not accepted :default
so you might actually be better off using countup/default
for the time being if you care about compatibility. https://dev.clojure.org/jira/browse/CLJS-2376
David is very hesitant to add features that are not in Clojure which is reasonable. Given that JS is so different I do not agree with several of his choices however. I fully expect to change his mind about this with time.
@kenny turns out I'm actually wrong. .default
is part of the spec. Just re-read the spec and it is definitely defined as a getter.
Good to know. I'd definitely prefer that over the ns :default
syntax just because I like aliasing things over referring them.