This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-03
Channels
- # announcements (11)
- # aws (1)
- # beginners (57)
- # calva (14)
- # cider (22)
- # clara (23)
- # cljdoc (21)
- # cljs-dev (14)
- # clojure (76)
- # clojure-austin (3)
- # clojure-europe (32)
- # clojure-finland (1)
- # clojure-gamedev (5)
- # clojure-italy (3)
- # clojure-nl (17)
- # clojure-poland (4)
- # clojure-spec (23)
- # clojure-uk (29)
- # clojurescript (72)
- # cursive (6)
- # data-science (4)
- # datomic (2)
- # dirac (10)
- # duct (3)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (86)
- # jackdaw (5)
- # juxt (2)
- # kaocha (2)
- # leiningen (16)
- # off-topic (47)
- # pathom (46)
- # protorepl (2)
- # reagent (4)
- # reitit (14)
- # ring-swagger (5)
- # shadow-cljs (43)
- # spacemacs (13)
- # sql (13)
- # tools-deps (6)
Well, I mean, cljs doesn’t have it. Is it possible that shadow-cljs provide this function?
@markx Do you mean something like this? https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-library
@markx you mean https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html just for node?
Kinda, but not really. Current I have the need to dynamically load code source at runtime. There are clojure.core/load
and clojure.core/load-file
, but not available in cljs. So I’m wondering if this is possible via shadow-cljs.
in order to evaluate code at runtime, you have to follow the steps in that blog post
normally the CLJS compiler is not included in your bundle. in order to use eval
, you have to include it
Great, so it could eval
. Does it still only support browser though? I’ll need to use it on nodejs to load local files.
I added support for node. you just use the shadow.cljs.bootstrap.node
ns instead of the browser
one
(ns demo.bootstrap-script
(:require
[cljs.js :as cljs]
[cljs.env :as env]
[shadow.cljs.bootstrap.node :as boot]))
(defn print-result [{:keys [error value] :as result}]
(prn [:result result]))
(def code "(prn ::foo) (+ 1 2)")
(defonce compile-state-ref (env/default-compiler-env))
(defn compile-it []
(cljs/eval-str
compile-state-ref
code
"[test]"
{:eval cljs/js-eval
:load (partial boot/load compile-state-ref)}
print-result))
(defn main [& args]
(boot/init compile-state-ref {} compile-it))
:bootstrap-script-host
{:target :node-script
:main demo.bootstrap-script/main
:output-to "out/demo-bootstrap/script.js"
:compiler-options
{:optimizations :simple}
:devtools
{:enabled false}}
:bootstrap-script-support
{:target :bootstrap
:output-dir "out/demo-bootstrap/bootstrap"
:exclude #{cljs.js}
:entries [cljs.js demo.macro]
:macros []
:js-options
{:js-provider :require}}
{:deps {:aliases [:dev :test]}
:builds ...}
If I am using deps.edn
and define multiple aliases, which one is used for development and which one is used for release build? For example, if I have cider-nrepl
in the dev alias, will it get included in release build? From my experiment, it looks like shadow-cljs is doing the right thing, but would like to know how.in this case, cider-nrepl
is a Clojure dep so there's no way it will end up in your release 😉
Hi! Is there a way of pulling clj/cljs dependencies from private s3 repos? I've looked for something like this in doc but cannot see anything
:repos
{"s3-private-snapshot" {:url ""}
"s3-private-release" {:url ""}}
Kinda, but not really. Current I have the need to dynamically load code source at runtime. There are clojure.core/load
and clojure.core/load-file
, but not available in cljs. So I’m wondering if this is possible via shadow-cljs.
in order to evaluate code at runtime, you have to follow the steps in that blog post
@robert.law yes, use :repositories
not :repos
though. same as in lein
. this is the lib used for that https://github.com/s3-wagon-private/s3-wagon-private
thanks that worked
Currently I’m trying to build an web app, including both clojure backend and cljs SPA. I think the backend will already have a http server for the api, so I’m looking to use this server to host static assets too, e.g. js files. But on dev, I also want shadow-cljs’ dev http server, so I can have hot-loading and everything. Is it possible to reuse my clojure http server as the shadow-cljs dev server?
the websocket stuff is handled by the server running on :9630
, nothing to do with the dev http server