Fork me on GitHub
Oliver George00:03:22

Funny that should be the topic right now. I'm here to ask if there's a recommendation for how to break up that vendor bundle because the page is taking 5s to load!

Oliver George00:03:35

In my case there's a dependency needed for generating PDFs which isn't needed immediately. That adds something like 2.5mb to the js. (


and then the modules however make sense for your project


there I have codemirror which is also a pretty large dependency. I delay loading it until it is actually used.

Oliver George08:03:49

Seems like :js-provider :external might complicate this

Oliver George08:03:14

But that's speculation. I’ll give it a go.


that is correct yes. :external will move all JS deps into one single file.


the way webpack handles code splitting is entirely different than the closure compiler. so the two don't really get along.


in theory it should be possible to combine the two somehow. just haven't figured out how that would need to look on the webpack side or how you'd even configure that


if some webpack export wants to help out I'd be happy to write the cljs side of things 😛

Oliver George08:03:32

Thanks. Yep. All a bit messy.

Oliver George08:03:58

I would happily ditch webpack but the pesky WASM dependency gets in the way.


some wasm deps allow you to control how the wasm is actually loaded


in that case it can be easily integrated but it all depends on how that wasm glue code came about


I did some stuff a while ago, maybe that is still accurate in some way

Oliver George08:03:33

Thanks again. I'm really not across the wasm details. This react-pdf dep is wrapping pdfkit which is probably quite professional I guess.


pretty sure pdfkit also offers a CDN version. so that may also work


so even just moving out pdfkit can work

Oliver George08:03:10

I’ll look into that - thanks again


@thheller UX suggestion: the "dependency trace" tooltip in the build report tends to go off-screen (and thus become unreadable) when there are lots of modules. It'd be better to use an expand/collapse toggle like what you already have for the "groups".


I’m trying to set up a web worker, but I keep getting the error worker.js:67 Uncaught Error: Namespace "goog.dispose" already declared.. Does anyone know why this is? shadow-cljs config:

:worker {:init-fn!
         :depends-on #{:shared}
         :web-worker true}}

(js/console.log "worker/read!")

(defn load! []
  (js/console.log "worker/load!"))
(defn init []
  (let [worker (js/Worker. "/js/worker.js")]
    (.addEventListener worker "message" notify-worker-message)))


^ solution: needed to update shadow-cljs. Was the first thing I tried, but my globally installed version of node_modules was using 2.16.12. Updated it to the latest and everything worked like a charm 🙂

👍 1