Fork me on GitHub

Tried converting a big reagent app to use the bundle target and webpack, it seems to work fine locally but production build takes a very long time (from 90 seconds to 16minutes) and some cljsjs deps didn’t work in the advanced compiled output… I should probably just upgrade all the cljsjs deps to their npm versions and not mix npm/cljsjs


Not an expert, but this definitely sounds strange


seems that webpack is the slow part, seeing a node process which is using a single core for most of the duration


I'm following the [Krell reagent tutorial](, but running clj -m krell.main -co build.edn -c -r I'm getting compiler/analyzer exceptions because it can't find react-dom


should I install react-dom just to satisfy that dependency (even though I imagine it won't be used), or is there a way to not have it compile reagent.dom?


ah I think I missed a step duckie

duckie 4

yay! @dnolen I did have to add a :paths ["src"] to deps.edn, I think that should be updated in the tutorial?


@plexus strange, I thought that’s the default in deps


maybe it's a red herring... it wasn't finding awesome_project/core.cljs, when I added it it did


it’s at least there on my system by default


~/d/testdeps ❯❯❯ echo "{}" > deps.edn
~/d/testdeps ❯❯❯ clojure -Spath


yeah :paths should be set for you, and I haven't heard about that one before from others

Michaël Salihi14:05:19

Yes for me too, src is default included in path without to specify in deps.edn...strange for you @plexus


That's been the default since very early.

Brandon Olivier23:05:20

Is it possible to get webpack tree shaking for a project I'm importing into a cljs project?

Brandon Olivier23:05:36

Specifically, I maintain a react component lib at work, and I'd like to import some of those components into a cljs project.


@brandon149 what is your CLJS project using to build?

Brandon Olivier23:05:30

I'm using shadow-cljs


shadow-cljs will only include the JS files that you require

👍 4
Brandon Olivier23:05:46

I'm not married to it, it's just what I'm most familiar with

Brandon Olivier23:05:22

In that case, I need to double check some stuff


so if you require your JS components in a cljs namespace like:

(ns my-app.feature
  (:require ["component-lib/Foo" :as Foo])) 
it should only include the Foo file and any dependencies of it


this is assuming some things, like you’re deploying your component library as either CommonJS or ESM

Brandon Olivier23:05:02

ah, right now I require the whole lib and the final bundle is massive


yeah, this is a common question with component libraries like material-ui


you can see the example of how to fix this here:


I’m not sure how your component library is structured, but the idea is that you want to require just the files that you need and shadow-cljs will handle the rest

Brandon Olivier23:05:41

I never intended it to be consumed by non-js libs, so hopefully it works out 😅

Brandon Olivier23:05:49