Fork me on GitHub
#shadow-cljs
<
2023-03-15
>
michihuber09:03:36

We have a webworker script that has shared code with our main script. It requires shared.js but during deployment we fingerprint our files. What is the best way to deal with fingerprinting? Or just turn off code splitting? (also, how would we turn that off)

thheller09:03:02

use npx shadow-cljs release app --config-merge '{:release-version "v1"}'

thheller09:03:33

that tags the shared.js as shared.v1.js which the worker will load automatically

thheller09:03:01

as for loading the worker.v1.js that is up to you how you handle that

thheller09:03:29

see the manifest if you do server side stuff

michihuber09:03:04

awesome, even md5 hashing

michihuber09:03:05

many thanks!

michihuber09:03:26

unbelievable how great shadow.cljs is

thheller09:03:54

note that hashing currently does NOT work with workers

thheller09:03:26

since putting the hashed name of a file changes the hash of a file 😛

michihuber09:03:52

ok, we will work with versions

thheller09:03:53

I recommend :release-version always, hash is a bad concept.

michihuber09:03:14

got it, thanks

michihuber11:03:29

(let [config (shadow.config/get-build! :browser) config* (assoc config :release-version version-tag

michihuber11:03:35

should this work?

michihuber11:03:16

nevermind, sorry

thheller14:03:22

you can also :config-merge [{:release-version ...}] with the regular commands

thheller14:03:36

so (shadow/release :the-build {:config-merge ...})

Ivan Fedorov11:03:13

Hello Thomas! Any tips on how to enable development mode for React? React https://overreacted.io/how-does-the-development-mode-work/ say it uses process.env.NODE_ENV expression, that in frontend will be replaced with a string literal. Is that the place to use :closure-defines ? I want it in hopes that it will improve my chrome performance tab experience with “user timing” https://calibreapp.com/blog/react-performance-profiling-optimization UPD: react dev tools say I’m already using a development build (but I just enabled these constants)

Jakub HolĂ˝ (HolyJak)12:03:05

Hello folks! Is the docs of shadow’s api somewhere? https://cljdoc.org/d/thheller/shadow-cljs/ says the build failed and shows nothing 😭 https://github.com/thheller/shadow-cljs only mentions user manual and that one is little too long to scan. (In particular I am looking for a way to load a .edn into a def at compile time, I know there is a shadow fn for that but can never find it 😅 ) Thank you!

Jakub HolĂ˝ (HolyJak)13:03:07

I did find shadow.resource/inline via GitHub in the end. Still would like to know if the api docs are somewhere…

thheller14:03:04

> says the build failed and shows nothing

thheller14:03:13

there are no api docs no

👍 2
thheller14:03:25

what do you mean shows nothing though?

Jakub HolĂ˝ (HolyJak)14:03:42

ok, thx I mean “no api docs” The readme is there

thheller14:03:09

ah, lol thought you meant a build shadow-cljs does 😛

Jakub HolĂ˝ (HolyJak)14:03:43

Another question: Any idea why (shadow/compile! :app nil) might be failing with > Execution error (IllegalArgumentException) at shadow.build.closure/set-options (closure.clj:166). > No matching method legacySetOutputFeatureSet found taking 1 args for class com.google.javascript.jscomp.CompilerOptions ? Running from the CLI works just fine…

thheller15:03:40

try {} instead of nil? otherwise probably a version conflict. make sure you get the expected shadow-cljs,clojurescript,closure-compiler combo.

Jakub HolĂ˝ (HolyJak)15:03:45

{} gives same error. In my project.clj I have only

[org.clojure/clojure "1.10.3"]
                 [com.cerner/clara-rules "0.21.1"]
                 [org.clojure/core.logic "1.0.1"]
                 [dev.weavejester/medley "1.6.0"]
                  [org.clojure/clojurescript "1.11.60"]
                 [thheller/shadow-cljs "2.22.2"]
Not sure what could conflict with shadow?

thheller15:03:06

that doesn't guarantee the closure-compiler version you get

thheller15:03:15

since you listed cljs first, you likely getting its version, which is too old

Jakub HolĂ˝ (HolyJak)15:03:55

And where does the compiler one come from? How do I force the correct version?

thheller15:03:23

check lein deps :tree. I'm only guessing here, verify what you get

thheller15:03:54

should be [com.google.javascript/closure-compiler-unshaded "v20230228"], if not add this to your deps

Jakub HolĂ˝ (HolyJak)15:03:16

Where in the user guide did I overlook this? To know where to look for troubleshooting next time 😅 I checked https://shadow-cljs.github.io/docs/UsersGuide.html#_installation

aaelony15:03:24

My google searches are pointing to blogs from 2015 or earlier. What libraries or techniques are currently recommended for authenticating users and having a separate experience for users that are anonymous versus logged-in in a reagent shadow-cljs app?

👍 2
thheller15:03:18

wrong channel. shadow-cljs is the build tool. it is not involved in any of that. better ask in #C0620C0C8 #C073DKH9P or #C03S1L9DN

👍 2