Fork me on GitHub
David Pham06:07:12

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.

Chris McCormick07:07:27

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?

Drew Verlee16:07:51

I believe you could output your build/release artifacts to another file so they didn't clash.


@magra they don't leak into production unless you builds includes them?


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


please first describe what your actual problem is


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.


what commands are you running?


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.


now explain WHY you are doing that? like what is the difference in the profiles?


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


the JVM properties are for CLJ




     :app  {:target            :browser
            :dev               {:compiler-options
                                {:external-config {:guardrails {:throw? false}}
                                 :closure-defines {goog.DEBUG true}}}


you don't need the -Dguardrails...


I need -Dguardrails for the backend.


then use a different profile for the backend and CLJS?


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


this never uses the running server and always starts a new process


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 deps.edn aliases. just too used to lein which calls them profiles.


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.


the guardrails readme shows how to enable it for dev?


I’m working on a node script in IntelliJ/Cursive and I notice all the JS symbols are coming up “cannot be resolved”. Is there a way to fix this?


Okay, thanks


well you can fix it by disabling that warning 😛


I think there is an open Cursive issue about this


Yes, there is, I’m planning to do what I can about this soon-ish.

🎉 6

Does shadow-cljs process JS with async/await functions? I’m trying to use a module that exports one and not having much luck

const getPath = async path_ => {
SyntaxError: Unexpected identifier