omcljs / om

ClojureScript interface to Facebook's React
6.65k stars 364 forks source link

Om Next pulling in cljs.analyzer namespace #884

Open mfikes opened 7 years ago

mfikes commented 7 years ago

With the enhancement for server-side rendering support, Om Next is inadvertently adding the cljs.analyzer namespace as dependency in JVM ClojureScript builds.

In concrete terms:

(ns example
  (:require [om.next :as om :refer [defui]]))

results in cljs.analyzer here.

In a downstream project, as a result, compiling with :advanced increases by 112k unzipped and around 31k zipped. Here are the actual numbers:

Release Uncompressed Zipped
1.0.0-alpha44 420,316 106,921
1.0.0-alpha45 535,344 139,291
dupuchba commented 7 years ago

it is still needed right ? => https://github.com/omcljs/om/blob/c68e668a73cc534ecfdc71d6314abc3af911657e/src/main/om/next.cljc#L403

mfikes commented 7 years ago

@dupuchba The dependency on this namespace was only added inadvertently with https://github.com/omcljs/om/commit/7aa8e81ba93899ca3dcd7b924f4e12e903b62b0d The solution is indeed not to simply remove it from the ns form, but to somehow only depend on it when being compiled by the self-hosted compiler.

alexanderkiel commented 7 years ago

I have just put everything which needed cljs.analyzer into #?(:clj and I save about 91 kB in my real-world project. I don't have experience with self hosting. Also boot gives me errors if I try to run tests. So for now. I can't really do anything, but I would be more than happy to save this 91 kB.

I found this issue because I searched for big parts in my advanced compiled script. cljs.analyzer is quite on top of my list.