[ClojureScript] Re: app.js around 1.9MB : need help
On Friday, February 24, 2017 at 11:04:32 PM UTC+2, Oskar Skuteli wrote: > Hi, can you please give any info on the bug in cljsjs/material-ui you've > found? > I'm new to cljsjs packages, but would like to try to fix it, as my app relies > on material-ui and its size is slowing things significantly... A note on the package readme should mostly take care of this: https://github.com/cljsjs/packages/tree/master/material-ui#important-note but if not, you'd best ask madvas on Slack -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.
[ClojureScript] Re: app.js around 1.9MB : need help
Cljsjs/material-ui required by cljs-react-material-ui increases output size by about 1.4MB. 700KB of that is necessary, other 700KB is caused by bug in cljsjs/material-ui which causes the code be included twice. - To save 700KB, fix cljsjs/material-ui - To save more, stop using material-ui, or - Wait for Closure and ClojureScript to support npm/commonjs module processing which would allow running dead code elimination on material-ui code On Saturday, October 1, 2016 at 8:15:08 PM UTC+3, Raghu K wrote: > Hi All, > I have created a luminus web project and after the final compilation i get > the app.js to be around 1.9MB. I am using the advanced compilation. > Any ideas on how to reduce the file size. > My project.clj is as follows > :description "FIXME: write description" > :url "http://example.com/FIXME; > > :dependencies [[ch.qos.logback/logback-classic "1.1.7"] > [re-frame "0.8.0"] > [cljs-ajax "0.5.8"] > [secretary "1.2.3"] > [reagent-utils "0.2.0"] > ;[reagent "0.6.0-rc"] > [reagent "0.6.0-rc" :exclusions [org.clojure/tools.reader > cljsjs/react]] > [org.clojure/clojurescript "1.9.225" :scope "provided"] > [org.clojure/clojure "1.8.0"] > [selmer "1.0.7"] > [markdown-clj "0.9.89"] > [ring-middleware-format "0.7.0"] > [metosin/ring-http-response "0.8.0"] > [bouncer "1.0.0"] > [org.webjars/bootstrap "4.0.0-alpha.3"] > [org.webjars/font-awesome "4.6.3"] > [org.webjars.bower/tether "1.3.3"] > [org.clojure/tools.logging "0.3.1"] > [compojure "1.5.1"] > [ring-webjars "0.1.1"] > [ring/ring-defaults "0.2.1"] > [luminus/ring-ttl-session "0.3.1"] > [mount "0.1.10"] > [cprop "0.1.9"] > [org.clojure/tools.cli "0.3.5"] > [cljs-react-material-ui "0.2.19"] > [luminus-nrepl "0.1.4"] > [buddy "1.0.0"] > [com.draines/postal "2.0.0"] > [com.taoensso/timbre "4.1.1"] > [org.clojure/core.async "0.1.346.0-17112a-alpha"] > [alandipert/storage-atom "2.0.1"] > [twilio-api "1.0.1"] > [luminus-http-kit "0.1.4"]] > > :min-lein-version "2.0.0" > > :jvm-opts ["-server" "-Dconf=.lein-env"] > :source-paths ["src/clj" "src/cljc"] > :resource-paths ["resources" "target/cljsbuild"] > :target-path "target/%s/" > :main materiall.core > > :plugins [[lein-cprop "1.0.1"] > [lein-cljsbuild "1.1.4"]] > :clean-targets ^{:protect false} > [:target-path [:cljsbuild :builds :app :compiler :output-dir] [:cljsbuild > :builds :app :compiler :output-to]] > :figwheel > {:http-server-root "public" >:nrepl-port 7002 >:css-dirs ["resources/public/css"] >:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]} > > > :profiles > {:uberjar {:omit-source true > :prep-tasks ["compile" ["cljsbuild" "once" "min"]] > :cljsbuild > {:builds > {:min >{:source-paths ["src/cljc" "src/cljs" "env/prod/cljs"] > :compiler > {:output-to "target/cljsbuild/public/js/app.js" > :externs ["react/externs/react.js"] > :optimizations :advanced > :pretty-print false > :closure-warnings > {:externs-validation :off :non-standard-jsdoc :off} > > > :aot :all > :uberjar-name "mater.jar" > :source-paths ["env/prod/clj"] > :resource-paths ["env/prod/resources"]} > >:dev [:project/dev :profiles/dev] >:test [:project/test :profiles/test] > >:project/dev {:dependencies [[prone "1.1.1"] > [ring/ring-mock "0.3.0"] > [ring/ring-devel "1.5.0"] > [pjstadig/humane-test-output "0.8.1"] > [doo "0.1.7"] > [binaryage/devtools "0.8.1"] > [figwheel-sidecar "0.5.4-7"] > [com.cemerick/piggieback "0.2.2-SNAPSHOT"]] > :plugins [[com.jakemccrary/lein-test-refresh "0.14.0"] > [lein-doo "0.1.7"] > [lein-figwheel "0.5.4-7"] > [org.clojure/clojurescript "1.9.225"]] > :cljsbuild > {:builds >{:app > {:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"] >
Re: [ClojureScript] Re: [ANN] CLJSJS
On Tuesday, January 6, 2015 1:20:04 PM UTC+2, Thomas Heller wrote: That's right but for some projects the assumption that .min.js means minified is just not true. E.g. React ships with different logging levels enabled based on wether you're including the development or production build. I'm sure there are more projects that include extra debugging stuff that's stripped while packaging. You are right, I guess I'm too spoiled by CLJS/Closure that I don't have to worry about things like that. ;) As a build tool author I don't quite agree with using a naming convention to detect the files (eg. *.inc.js, ...). You could never package more than one file this way since there would be no way to tell the compiler: file Y needs to be added before file B. Very fair point. We haven't actually come across that situation as most libs are distributed as single files but I agree that this might cause problems with libraries that are distributed with multiple files (Thinking of Bootstrap - although that's a whole other beast). I was thinking in terms of my project. The only external (non-closure) JS I use is CodeMirror. I have several different builds, most of them do not need CodeMirror. Yet CLJSJS (boot) would prepend it to everything. Also in my case not all builds use the same amount of CodeMirror (eg. one gets clojure-mode vs the other does not). Using boot it's easy to filter fileset so that some of files are removed before cljs task picks up the .inc.js files: (sift :exclude #{#^cljsjs/.*codemirror.*}) But several different builds (different apps or modules) is indeed still an area where boot will need some work. It should be possible to build several apps from same sources etc. but all resulting js would contain all the same shared code. This stuff is pretty complex, I don't think we can solve it by just creating a few jar files. We MUST address the fact that the produced JS files are shipped to clients (ie. browsers) a lot, therefore we must take great care that they don't contain unnecessary stuff. Shipping CodeMirror to everyone of our users would be a disaster since it is only used for backend/admin stuff. One way would be to build your admin/backend application as a separate app which would have it's own maven dependencies. Or, using boot, it's possible to remove and add maven dependencies as build steps. So there are ways to control what gets included to build but it's manual work as there is no way to know what external code is actually used by the built js. I think the greatest problem is that there exists libraries which are pretty useless without custom built step (e.g. Highlight.js is one I encountered). CodeMirror modes and add-ons is also such one. I'm not sure how it should or could be packaged. /thomas -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.