any places to look when running with a release build, I get undefined is not an object (evaluating 'Z4.$l')
but it works just fine when running dev builds?
Issues with externs. Likely whatever Z4
was before, it shouldn't have been renamed.
Or you have something different happening in the release build so that Z4
is a genuine variable that has a value of undefined
.
@benny turn on externs inference if it isn't on (wasn't the default as of very recently) https://shadow-cljs.github.io/docs/UsersGuide.html#externs
looks like an externs renaming issue
Is it possible to not start nrepl server when using shadow.cljs.devtools.server/start?
in shadow-cljs.edn: > The nREPL server can be disabled by setting :nrepl false.
may be that works?
see: https://shadow-cljs.github.io/docs/UsersGuide.html#nREPL
Is there some gotchas when hot-reloading a namespace that uses macros? Trying to use clara-rules defrule macro and every time I save the namespace shadow complains about undeclared vars, which are functions defined in the namespace and originally compiled fine
additionally when moving these functions to another namespace it also works fine
not enough information to comment
(ns notifications.notifications
(:require [clara.rules :as clara])
(:require-macros [clara.macros :refer [defrule defsession]]))
(defsession session 'notifications.notifications
:fact-type-fn :type)
(defn testz [user-id]
{[:user/id user-id] [:user/id]})
(defrule follow
"A rule which isd fired on every follow"
[:context [env] (= ?env env)]
[:follow [{followed-id :followed/id user-id :user/id}]
(= ?followed-id followed-id)
(= ?user-id user-id)]
=>
(testz ?user-id))
(defn handle-event [env event]
(-> session
(clara/insert (merge env {:type :context})
event)
(clara/fire-rules)))
I don't know much about clara-rules so no clue what that code does
I know that is uses a clojure side atom and does not play well with caching
so could be likely that it also doesn't play well with incremental compilation at all
yeah it looks like it's something like that because rules that are deleted keep throwing undeclared-var compilation errors
so disabling caching could help?
if you want to completely obliterate recompile performance 😉
no clue to be honest. maybe there is something you can call to "reset" its state
https://shadow-cljs.github.io/docs/UsersGuide.html#_compiler_cache
cache is off by default for clara already
Hi, I'm wondering how to manage subproject through shadow-cljs. My situation is the following: I want to create a main project on a private repository and this project should use an "embedded" subproject which is public and should remain public. Both on them will use shadow-cljs.edn as build configuration file. Is there a convenient way to embed a subproject with shadow-cljs?
you can use deps.edn or project.clj to do this
shadow-cljs.edn itself does not support this
well you can just add :sources-paths ["src/main" "../that-subproject/src/main"]
if its just about source paths
interesting even after completely disable the cache the initial compilation works then I get undeclared variables 😕
@yenda diid you restart the shadow-cljs process? as I said the library keeps some CLJ side state that isn't part of any shadow-cljs cache or so you could reset
OK, thank you @thheller, always reactive, always amazing ! Yes, I can manage this with the classpath, but I don't want to duplicate the dependencies of the subproject in the main project. I'll try the deps.edn approach, thank again
yes I restarted it
sorry don't know enough about the lib to even guess
looks like there is a clear-ns-productions! function
so I should use it in
:before-load <http://my.app/stop|my.app/stop>
you might also need ^:dev/always
on the ns https://shadow-cljs.github.io/docs/UsersGuide.html#_lifecycle_hooks
for macros that access the analyzer state directly
can't remember if that was necessary or not
Hi, I am just getting into clj/cljs dev. Is there a way to only use the shadow-cljs commandline tool for managing all deps (clj and cljs)? Or are deps.edn and/or lein always needed for the backend(clj) side?
All this clj (deps.edn), lein, and shadow-cljs configs confuse me
@slack1781 as far as I know, shadow-cljs is dedicated to clojurescript project, or javascript aspect of a project.
ok works
(clara/clear-ns-productions!)
needs to be put in the ns
nothing else required
So I have a shadow-cljs project, and I want to disable CORS (i.e. inject permissive CORS headers) for the shadow-cljs watch
command. How can I make this happen?
FWIW I thought the :push-state/headers
key as described in the docs (https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http) seems promising for this, but adding it doesn’t seem to have any effect
Maybe I’m putting it in the wrong place?
As I use many npm package, it's finally easier to keep using shadow-cljs ^^
Nevermind, I figured it out 🙂
how can I set environment vars for development vs prod. I am reading this section of the docs (https://shadow-cljs.github.io/docs/UsersGuide.html#shadow-env), but I am used to starting shadow with Cider, so I am not even sure how I set the env vars there.
I just want to point the api endpoint to somewhere else, so it's something quite trivial
{...
:builds
{:app
{:target :browser
...
:modules {:app {:entries [<http://your.app|your.app>]}}
;; to enable in development only
:dev {:closure-defines {<http://your.app/VERBOSE|your.app/VERBOSE> true}}
;; to enable always
:closure-defines {<http://your.app/VERBOSE|your.app/VERBOSE> true}
;; you may also enable it for release as well
:release {:closure-defines {<http://your.app/VERBOSE|your.app/VERBOSE> true}}
}}
you could use :dev
and :release
to use hardcoded versions. or start shadow from the command line and then cider-connect-cljs to the already running instance with easily set env varsthanks @dpsutton
you could also call (setenv VARIABLE VALUE)
. make a function that does this and then calls cider-jack-in-cljs and you might be good if you really wan to stay in emacs
Awesome, thanks
for work i use
(cider-connect-cljs (list :host "localhost"
:port 7888
:cljs-repl-type 'figwheel-connected
'project-dir "~/projects/aclaimant/acl"))
in a function. you could adjust that as needed with a call to set-envHas anyone seen npx shadow-cljs watch :main
running forever? Like so:
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.33s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.33s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.49s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.49s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.39s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.35s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.33s)
[:main] Compiling ...
[:main] Build completed. (286 files, 2 compiled, 0 warnings, 0.34s)
... (forever) ...
I did not touch any code during this time..
What triggers a re-compilation in watch mode?
And if I delete the compiled folder, and restart the watch, the problem resolves ... weird
@zhuxun2 this can happen if your :output-dir
is also on any of the :source-paths
@thheller But isn't that usually the case? for example, I usually use "resources/public/js" as the output directory, but "resources" is usually one of the source-paths
yes, but that is filtered. the filter is very basic so it may not properly filter all the stuff
I thought I fixed most cases but maybe I didn't. not saying that this is the cause of your problem. just a guess.
if you have non-standard paths then it is more likely
Yes I do, I used a separate resources folder called "resources_dev" for the development compiles
Is there any workaround in that case?
call it dev-resources
😛
paths ending in resources
are filtered
which version is this? I though I fixed this in general but maybe I didn't
LOL, okay. I am using 2.9.10
Oh actually 2.8.58
hmm yeah maybe try upgrading. or just renaming that should definitely work
Okay I'll try. Why not make the filter an explicit setting?
it shouldn't be required at all anymore but that was definitely after 2.8.58
I see, yeah maybe I was just using an out-dated version .. thanks!