Fork me on GitHub
Oliver George04:02:05

Based on I'm switching to :js-provider :external because @react-pdf/renderer is incompatible (wasm) with the standard bunding approach. That means an extra step to run webpack after shadow-cljs compile to build a single js file. Wondering what the best way to handle the dev time case. Should I use :build-hooks to trigger the webpack after each build?

Oliver George04:02:40

Huh, got the PDF viewer working but broke everything else!

Module not provided: shadow.js.shim.module$react


check the :internal-index generated by shadow-cljs. it should contain require("react")


I strongly recommend NOT coupling anything webpack to your shadow-cljs build


just run it separately


if you don't change npm dependencies often you can usually just run it by hand


it only needs to run if you actually change npm requires, it does not need to run when you only work on cljs sources

👍 1

oh I just noticed "to build a single js file"


this is intended as two separate files and must be used as such


one for the webpack output and one for the shadow-cljs output


webpack must never process the regular output of shadow-cljs, only the :external-index

Oliver George08:02:45

Ah, "one single file" was confusing. Was aiming at a lib.js and an app.js.


ah ok. single file would cause errors like yours so that got me confused 🙂

Oliver George08:02:15

I'll do a simple repro and try and get a handle on it. It'd be lovely to keep shadow-cljs... this react-pdf lib just keeps sneaking in as a requirement (enterprise clients)


I setup this repo a while ago showing how to use a cdn version of pdfjs


maybe something similar works for you? all these pdf libs are kinda heavy


dunno how much react-pdf actually wraps

Oliver George08:02:48

Thanks but no CDN for this one I know of

Oliver George08:02:39

Basics work :-)

Oliver George08:02:46

Will look into my other issue

Oliver George08:02:57

Hopefully unrelated