This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-10
Channels
- # announcements (1)
- # babashka (44)
- # beginners (188)
- # calva (37)
- # chlorine-clover (28)
- # cider (12)
- # clj-kondo (40)
- # clojars (1)
- # clojure (323)
- # clojure-austin (7)
- # clojure-europe (20)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-spec (7)
- # clojure-uk (37)
- # clojuredesign-podcast (1)
- # clojurescript (30)
- # cryogen (2)
- # cursive (30)
- # data-science (1)
- # datomic (26)
- # emacs (1)
- # events (1)
- # figwheel-main (13)
- # fulcro (89)
- # garden (1)
- # graalvm (20)
- # graphql (8)
- # jobs (1)
- # jobs-discuss (1)
- # joker (6)
- # kaocha (125)
- # lambdaisland (1)
- # meander (42)
- # off-topic (18)
- # pathom (3)
- # pedestal (6)
- # shadow-cljs (55)
- # spacemacs (21)
- # sql (18)
- # tools-deps (8)
- # uncomplicate (2)
- # vim (1)
- # yada (3)
Hey, do you have any suggestions how to import https://adazzle.github.io/react-data-grid/docs/quick-start properly so I get the function? No matter what I try, I got undefined
when checking with (goog/typeOf)
or object
(which seems empty) when trying with ["react-data-grid" :as ReactDataGrid]))
@UB0EMUD34 which version are you on? or did you manually set :loader-mode :script
?
then you can either set :devtools {:loader-mode :eval}
in your build config or upgrade (which sets that as a default)
drastically reduces the number of requests which fixes cases like yours where you are loading too many files at once
{:deps {:aliases [:dev]}
:nrepl {:port 9000
:init-ns user}
:dev-http {8000 "resources/public"}
:builds {:main {:target :browser
:output-dir "resources/public/js/main"
:asset-path "/js/main"
:modules {:main {:init-fn spreadnotes.client/init}}
:devtools {:after-load spreadnotes.client/init
:preloads [com.fulcrologic.fulcro.inspect.preload]}}}}
if you upgraded I guess you updated the npm install but no the reference in deps.edn
?
(both deps and package.json are updated to .91 - but maybe it hadn't recompiled yet)
Hi, has anyone fiddled around with replumb + shadow-cljs? I'm trying to convert a personal project of mine to shadow-cljs and it uses replumb to provide cljs evaluation. Everything else seems to be working quite well but evaluation of anything that touches the CLJS runtime library (like trying to invoke let
, def
, +
) raises a warning :undeclared-var
, and it seems to think that the function should be found in the current ns.
Could this have to do with the module not having all the necessary runtime-stuff in it? I'll try to look into that one.
OK, it seems that there is indeed something different in the setup. If I explicitly evaluate
(js/goog.require "cljs.core")
(cljs.core/+ 1 1)
I get the expected output of 2. 🙂self-hosted stuff is done via the :bootstrap
target. pretty sure thats a full replacement to replumb though. see https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html for an example
Wow. Cool 🙂 So I could ditch replumb alltogether and just use that one? I'll take a look. Can you elaborate a bit (if you have time) could replumb be used at all, what is the fundamental thing that is different in figwheel vs. shadow-cljs in this regard?
I honestly can't remember all the details but basically the :bootstrap
target will pre-compile sources and the host build will just load them (instead of compiling itself)
OK. I'll dig into this. Thanks again!
@U05224H0W works now. I'll continue using replumb for now, but will consider transitioning to the one given in the blog post since it seems fairly straightforward. Thanks again!
is there a way to export functions with :target :node-library
so that they have the async
keyword
AWS lambda needs it and it looks like it's not working when just returning a promise in the cljs function that we export
For async handlers, you can use return and throw to send a response or error, respectively. Functions must use the async keyword to use these methods to return a response or error.
Here what the aws lambda doc is asking for:
const https = require('https')
let url = ""
exports.handler = async function(event) {
const promise = new Promise(function(resolve, reject) {
https.get(url, (res) => {
resolve(res.statusCode)
}).on('error', (e) => {
reject(Error(e))
})
})
return promise
}
nvm I was just confused, aws async lambda execution isn't what we wanted, it doesn't reply when the promise resolves, it just replies right away with empty 200 and keep execution going in the bg. The exported fn was working as expected
@yenda there is also no such thing as the async keyword at runtime. that is just syntax sugar for a function returning a promise
any good libraries/tips and tricks for doing configuration (such as yogthos/config) in shadow-cljs?
if you want to read from a file or env variables , you can use a macro to slurp at compile time
hmm what sort of macro would that look like?
we use a kind of load-config
macro combined with :closure-defines
goog/ENV like this code sketch
(defmacro load-config []
`(if (= js/goog.ENV "prod")
;; prod config
(load-from-file "prod-config.edn")
;; dev config
(load-from-file "dev-config.edn")))
the macro is just a .clj file (not .cljs file) and :closure-defines is in shadow-cljs.edn
hmm cool so load from file and then set the variables