Fork me on GitHub
#shadow-cljs
<
2020-12-05
>
wilkerlucio03:12:28

is there way to tell shadow to output exports using export ... format instead of Object.defineProperty(module.exports, ...)?

wilkerlucio03:12:54

using :npm-module target

benny09:12:38

can I use shadow-cljs to create an "uberjar" like node bundle? I want to compile something on one platform and transfer a single file or small archive to the target platform and have node it without any dependency issues

βœ… 3
thheller09:12:32

that doesn't bundle the dependency by default

thheller09:12:41

you can use something like https://github.com/vercel/ncc to make it fully self contained

benny10:12:03

weird, I used the release target and my single cljs dependency was bundled

benny10:12:46

oh sorry: node is on the target platform, but that's it. I don't need a single file executable, a single file script is enough for my usecase (arm7l system)

thheller11:12:11

yes if you only use CLJS and the built-in node packages that'll be fine as is

thheller11:12:34

but if you add any npm dependencies it'll either require the node_modules folder wherever you are running or post-processing a release build with ncc

theeternalpulse10:12:02

I'm trying to integrate flow-storm-debugger in my development workflow with shadow. It requires that you first call the flow-storm-debugger.main/-main and then connect using flow-storm-api/connect. I originally added a preload of a .cljs file but it needs to run the debugger in a clj context. Is there a way to execute that debugger.main namespace as part of my build?

thheller10:12:25

sorry I don't have a clue what flow-storm is

theeternalpulse10:12:18

It's a debugger that I can connect to, but it requires a startup beforehand in clojure, and connecting to it when the app loads

theeternalpulse10:12:59

Basically I want to run it beforehand, but I'm clojure, and then connect using a preload

thheller11:12:58

then run the clj part however the instructions tell you

thheller11:12:49

seems to be a separate application so you need to run it separately πŸ˜›

theeternalpulse16:12:48

right, I want it integrated into the build, so trying with the clj-run option

theeternalpulse17:12:23

That seemed to do it

theeternalpulse20:12:40

I was hoping there was a way to have preloads run clj files to execute so I could just do cider jack in from cider

wontheone116:12:56

Hello! I just started using shadow-cljs (I used leiningen only)

wontheone116:12:52

{:source-paths ["src" "test"]
 :dependencies [[com.taoensso/timbre "4.10.0"]
                [macchiato/core "0.2.16"]]
 :builds {:app {:devtools {:repl-init-ns backend.core
                           :repl-pprint true}
                :main   backend.core/server
                :target :node-script
                :source-map true
                :exports {:server backend.core/server}
                :output-dir "target"
                :output-to "target/main.js"
                :compiler-options {:optimizations :simple}}}
 :nrepl {:init-ns backend.core}}
^ My edn file looks like this but where do I put development dependencies. Can’t see example from the official doc. I want to include [binaryage/devtools "1.0.2"]

wontheone116:12:15

:profiles {:dev     {:source-paths ["dev"]
                       :repl-options {:init-ns user}
                       :dependencies [[midje "1.9.9"]
                                      [ring/ring-mock "0.4.0"]]
                       :aliases      {"test-ancient" "midje"
                                      "upgrade-deps" ["ancient" "upgrade" ":all" ":check-clojure"]}
                       :bikeshed     {:max-line-length 120
                                      :docstrings      false}}
^ Would using dev profile work? (This is from my leiningen project.clj )

thheller16:12:53

just include it always. doesn't matter.

wontheone119:12:43

@thheller Thank you. Just to clarify, do you mean I include it in :dependencies (top level)?

thheller20:12:23

@wontheone1 yes. it won't have any negative impacts.

wontheone120:12:04

Aha thank you. I guess some dead code elimination πŸ™‚ makes sense

thheller23:12:29

that doesn't apply. just adding a dependency does not automatically include it in a build. you actually need to require the namespaces it provides.