This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-29
Channels
- # announcements (7)
- # babashka (4)
- # beginners (21)
- # calva (31)
- # cljdoc (12)
- # cljsrn (5)
- # clojure (89)
- # clojure-europe (26)
- # clojurescript (9)
- # conjure (1)
- # cursive (3)
- # data-science (20)
- # events (2)
- # fulcro (4)
- # gratitude (7)
- # introduce-yourself (1)
- # lsp (24)
- # nextjournal (3)
- # off-topic (5)
- # re-frame (22)
- # shadow-cljs (48)
- # tools-deps (11)
Is there a way using a shadow-cljs build to get dependencies output as .cljs? I have a need for getting the original .cljs files but everything seems bundled in the app.js. My own project files are easy enough to find, but dependencies seem to live in the .jar files on the classpath.
I found it very common to run into issues when start a development REPL after a release build, or bulid a browser target after a node target. Deleting .shadow-cljs
always solve the problem. Should the caches from different build be separated?
@doglooksgood I have never deleted .shadow-cljs
and I don't hear much of others doing that. what issues are you running into? deleting the caches should absolutely not be happening and caches are already separated, so they cannot affect each other.
@jproche5 what do you need those files for? yes, dependencies live in .jar files. there is no direct way of having shadow-cljs output them for you. you can always get them yourself at any time if you need to
are you outputting into different directories? each build should live in its own directory (eg. :output-dir
). outputting into the same directory may cause files to be overridden and as such cause issues
Yes, I have different output directories, like resources/public/js
and resources/public/js/workspaces
.
when the release build is outputting to the same directory yes, they will otherwise overwrite the watch
files and watch
may overwrite the release
files
you can output to separate dirs via https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration
only shadow-cljs watch app
and then shadow-cljs release app
may interfere with each other
but none of this would break the caches either so deleting .shadow-cljs
would not do anything other than cause a rebuild
I do not know how to reproduce yet, I'll bring the stacktrace when I ran into the issue again. Maybe it's caused by releasing and watching at the same time.
@thheller I need them for displaying stack traces in http://sentry.io. cljs isn’t well supported in it’s source-map upload system. If I turn source maps on, and turn off any source map includes, and the source code is in a separate file, it can show them correctly. But to do that for libraries I have to hard code a path to .m2, and then extract from the .jar file, and it’s a pain.
uhm the source maps should contain all you need? they do include the sources if you create them for a release build?
I don't know what special handling sentry needs but it works fine in the browser so I'd assume it is fine in sentry too?
one would think so, but sentry won’t match them properly
it just shows the minified js in the stack trace
Yeah I think so
I have never used sentry so I really don't know much but you can easily look at the generated source maps
it does include all sources
and sourcesContent
so it should be all fine assuming all the paths map and such
also the paths shadow-cljs includes in the source map never refer to any file in .m2
, so I don't know where that info would come from
well unless you explicitely set the :source-map-use-fs-paths true
, which you definitely should not be setting for browser builds
paths are only refered to by their classpath resource name, never the actual file of the local disk
I will keep at it. with sourcesContent it works in the browser fine.
Hey #shadow-cljs! I’ve set up a custom build script and added a build to my module. I’d like to see all the files available on the classpath (trying to find any .css
files). Is there a way to access this information from a build hook - either from the build state or the general clojure environment? Or do I need to get the src dirs and read them myself?
EDIT I sole and adopted a function from shadow.build.classpath
which seems to do exactly what I want. Let me know if there is a better way out there thought!
(defn classpath-files
"searches classpath source source files"
[build]
(let [cp (:classpath build)]
(for [^File cp-entry (classpath/get-classpath-entries cp)
:when (and (.isDirectory cp-entry)
(not (classpath/is-gitlib-file? cp-entry)))
:let [root-path (.toPath cp-entry)]
^File file (file-seq cp-entry)
:when (not (.isHidden file)
:let [file-path (.toPath file)
resource-name (-> (.relativize root-path file-path)
(.toString)
(rc/normalize-name))]
:when (not (classpath/should-ignore-resource? cp resource-name))]
resource-name)))
Hello all! I am running https://github.com/fulcrologic/fulcro-template and when reload the web application, it takes a long time for the page to reload. Specifically, it looks like the remote-relay?...
. What can I do to make it quicker? Here is my network:
remote-relay a websocket. it stays open. it does not affect the speed of your page load?
When I press this button:
you are loading 13.9mb of JS so is that maybe the cause of the slow speeds? what kind of computer do you use?
2019 Macbook Pro
hmm that should definitely handle that fine. assuming it has memory left and isn't swapping?
could also be browser extensions slowing everything down. can't really say, this has very little to do with shadow-cljs
@thheller, OK, I will keep digging.
could also be the JS doing a lot of stuff on load that everything else has to wait for
Can I customize how shadow resolves javascript files to support the module require syntax path/to/dir
and have it load the index.js
file at that path? In other words, I’m trying to override what happens when shadow detects a directory path? It currently fails and throws FileNotFoundException
with a note that it’s a directory.
I’m trying to compile an existing js project, but webpack handles that situation by default so I need a way to replicate that behavior
if you are talking about https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js then no, there is no way to make that happen