This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-19
Channels
- # announcements (5)
- # beginners (36)
- # calva (2)
- # cider (26)
- # cljs-dev (2)
- # clojure (121)
- # clojure-spec (2)
- # clojure-uk (2)
- # clojurescript (12)
- # component (1)
- # conjure (6)
- # datomic (9)
- # docker (1)
- # fulcro (15)
- # lambdaisland (1)
- # malli (5)
- # meander (24)
- # off-topic (5)
- # re-frame (5)
- # reagent (3)
- # ring (3)
- # shadow-cljs (41)
- # sql (4)
- # vim (3)
- # xtdb (7)
Can you show us the code that you use? (Maybe clean the .shadow-cljs folder).
@roklenarcic shadow-cljs has no support for serving "assets" from node_modules
. it just deals with JS.
i have symlinked stuff from node_modules/...
into public
before which worked fine. if you have a build step it has to take this into account.
Hi, at the moment, to build production, I have to kill my dev environment and stop the shadow-cljs server to prevent cached dev dependencies (guardrails) to leak into production. Is there a way to tell shadow-cljs to not use the running server?
I believe you could output your build/release artifacts to another file so they didn't clash.
maybe I misused the word leaked, I apologize. I think I followed the instructions in the guardrails readme. They work fine if I stop the dev server everytime I want to build release. They throw if I forget to stop the dev server. Since @U05224H0W ansered in another thread a few days ago that maybe someone had inadvertantly a second shadow-cljs server running I thought there maybe is a way to have a second server running on purpose or maybe start shadow-cljs release in a way that it does not reuse the running dev server. If I read the guardrails docs correctly they suggest to always stop the dev server before release and provide a throw if I forgot to stop the dev server.
you are doing something that is absolutely NEVER required but not describing enough WHY you think you have to do it
I work on a fulcro project. It works fine and I have emacs and shadow-cljs running 8 hours at a time. When I want to release a main.js to a server I have to kill the shadow-cljs dev server.
I start dev like:
[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.8.0-alpha3 -d cider/piggieback:0.5.0 -d refactor-nrepl:2.5.0 -d cider/cider-nrepl:0.25.3-SNAPSHOT server -A:dev
I start release: npx shadow-cljs release -A:ui prod
ok now you provided some essential info. you are using deps.edn
aliases to switch dependencies. that cannot be done with a running server and does require a restart.
in general it is irrelevant what is on the classpath when building CLJS projects. the code only uses what is actually used, just the presence on the classpath does nothing.
ok. The jvm options in the profiles are different since dev includes the fulcro backend.
you don't need the jvm properties when building CLJS. you should configure via the build config as the guardrails doc show
...
:app {:target :browser
:dev {:compiler-options
{:external-config {:guardrails {:throw? false}}
:closure-defines {goog.DEBUG true}}}
...
npx shadow-cljs --force-spawn release -A:ui prod
also works but I'd strongly recommend building a setup that doesn't require switching deps.edn aliases
Thank you! That is what the question was about. But I still want to follow your guidance about the seperate profiles. What do you mean by different profiles since you seem not to mean different deps.edn aliases. At the moment I use cider to connect both clj and cljs on the conection that I start as shown above. Are you talking about starting a seperate jvm for server and UI and have two seperate connections from emacs without sibling connections?
I do mean that you create a :backend
alias and maybe a :backend-prod
or so and then one alias for :cljs
which just configures the guardrails via build config without jvm property
Ahh thank you!!!! I could not figure out the middle between the extremes. Thank your for your time and your patience!
could also add a :enable-guardrails-clj
alias that just sets the jvm property. so you can do clj -A:backend
and clj -A:backend:enable-guardrails-clj
I think my using cider-jack-in-clj&clj instead of two separate jackins prevented me from doing that. My dev environment used shadow-cljs for UI and Backend at the same time and I am going to change that. Thank you again and thank you for shadow-cljs!
For the archive: separate cider-jack-in-clj and cider-jack-in-cljs is completely possible works fine with above suggestions.