This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-21
Channels
- # beginners (73)
- # capetown (1)
- # cider (13)
- # cljsrn (4)
- # clojure (56)
- # clojure-russia (2)
- # clojure-uk (1)
- # clojurescript (50)
- # community-development (3)
- # cursive (1)
- # datomic (80)
- # defnpodcast (2)
- # emacs (2)
- # fulcro (16)
- # graphql (8)
- # hoplon (206)
- # immutant (43)
- # keechma (4)
- # lumo (4)
- # off-topic (26)
- # perun (2)
- # re-frame (2)
- # reagent (4)
- # remote-jobs (2)
- # rum (4)
- # shadow-cljs (82)
- # spacemacs (5)
- # vim (6)
:infer-externs :auto
with occasional ^js
typehints works really well. I use a lot of JS libs, and it’s become extremely rare to hit a problem. JS interop with :advanced
compilation used to be my #1 complaint with writing real-world clojurescript — frequent, painful, manual hunting of obscure bugs, interrupted by multiple-minute recompile times — and that whole experience is just gone now. I see an immediate warning whenever something should be hinted, I add a ^js
somewhere, and just keep coding.
I'm trying to add a foreign js lib
:builds {:app {:js-options {:resolve {"libcsound" {:target :file
:file "resources/libcsound.js"}}}
(:require ["libcsound"]))
The required JS dependency "libcsound" is not available, it was required by "csound_wasm/core.cljs"
Something I'm not doing right, tried :target :npm and :require instead of :file. Same error.:node-library
just directly delegates to node require
so we can't influence what that does directly
spent so much time on the browser stuff I never really got to any of the node things
although it will likely try to compile with with closure which will most likely blow up
ok, yes I think the relative works relative to the cljs source file "../../../" pattern
I opened this a while ago but didn’t get to it yet since I’m not sure how to resolve it properly. https://github.com/thheller/shadow-cljs/issues/131
of curiousity, you think that a node-library will perform better or worse in cljs-land when the compiled js-file is required or the original cljs source code is requried?
btw @thheller you have been an awesome help over the last few days. really appreciate you taking the time to help through some of these issues I’m having
@lilactown np. a few people have been using shadow-cljs with macchiato already and I still want to look at the template and create one for shadow-cljs
here is one project that might help https://github.com/mjmeintjes/shadow-cljs-macchiato
the only problem was that macchiato does not properly declare the npm packages it depends on
ah yeah. ran into one dep that the cuerdas
library needed, but other than that I’ve been able to run it just fine. just working on hot loading
Im creating a node-module in cljs code for js users, but I can theoretically use that library im creating in cljs as well. Then I'm just wondering if it's worth releasing .jar and npm package, or is npm package fast enough that it wont make a difference.
question, since I’m not familiar with what-all-does-what yet: macchiato uses mount to “manage state” (still not exactly clear on what that means in context). would it make sense to use mount to manage the web server?
e.g. instead of storing a reference to the http/server obj in an atom, setup mount to manage start/stoping
yes. we use luminus-generated cljure server code and that is how it uses mount
from the template it looks like figwheel doesn’t bother with restarting the server at all
which might work but node it notorious for keeping some state in some function closures somewhere
when I tried to just drop in the core/server fn to :after-load
, it complained that a server was still running on the port
so I kind of assumed that figwheel was doing some kind of figgy magic to reload the server, but I really don’t know
I think I actually would rather not restart the HTTP server, since that might clear out my session state
@lilactown fwiw, I use mount on the backend side exactly for that
@lilactown 3 components - http server (with immutant), an nrepl server, and a hikariCP instance for the database
@lilactown you can get it to not do anything on a namespace reload, for example - or you can tell it to stop and start the server - depending on what you want
it does look like it clears out my session state when I restart the HTTP server, though. which means I don’t want to restart on each hot reload
not sure where the session state is kept but you can probably store it somewhere and re-attach on restart
if you dont’ want to use the the :before-load
and :after-load
callbacks just set :autoload true
it does 😵 I set up a repo: https://github.com/Lokeh/shadow-cljs-macchiato
https://github.com/Lokeh/shadow-cljs-macchiato/blob/master/src/server/routes.cljs has the routes definition and https://github.com/Lokeh/shadow-cljs-macchiato/blob/master/src/server/core.cljs has the http server that creates the handler for the routes
so the server.core
keeps a reference to the router
. :handler (wrap-defaults router)
this won’t be reloaded.