The docs for :module-hash-names
explains I should probably use the generated manifest.edn
with it, but can't seem to find any ways of not having to manually (or write a script for it) replace the path in my index.html to the fingerprinted bundle. Is there no option for this?
Ended up adding some sed and jet commands to my deploy file to workaround in the meantime. But would be happy to hear if this is build-in somewhere!
I wrote a proof-of-concept a while ago that can do this
:build-hooks
[(shadow.html/copy-file
"out/demo-browser/index.src.html"
"out/demo-browser/public/index.html")]
in your build config
expects to find a <script src="/js/main.js">
if you build config has :asset-path "/js" :modules {:main ...}
and will replace that with the hashed name
or you could replace the bash file you have and write it entirely in clojure
and use clj-run
to trigger the function
oooh, the build-hooks stuff is just what I was looking for! Thanks!
if I had the time I'd send you a PR to add the build-hooks example to right after where it says "it gets a little bit more complicated to include them in your HTML" in the docs
otherwise, cheers for shadow-cljs! Minimal hassle so far 🙏
Is there a workaround for transit-cljs compilation warning besides turning warning as error to false in release builds?
@yenda :warnings-as-errors {:ignore #{transit.*}}
I believe?
thanks, actually I realize it's not coming from transit-cljs but from this snippet in our code base
(deftype DefaultHandler []
Object
(tag [this v] "unknown")
(rep [this v] (pr-str v)))
Cannot infer target type in expression (. (. DefaultHandler -prototype) -rep)
{:warning :infer-warning, :line 8, :column 1, :msg "Cannot infer target type in expression (. (. DefaultHandler -prototype) -rep)"}
ExceptionInfo: Cannot infer target type in expression (. (. DefaultHandler -prototype) -rep)
hmm yeah I don't know why that warns but had that in my own code
didn't have time to look into it but (set! *warn-on-infer* false)
is a quickfix until then 😉
actually not sure if it's better or not but I got rid of it by typehinting
(deftype ^js DefaultHandler []
Object
(tag [this v] "unknown")
(rep [this v] (try
(str v)
(catch :default e
(when goog.DEBUG
(log/warn "Transit was unable to encode a value."))
"UNENCODED VALUE"))))