Fork me on GitHub

If you are using re-natal by default there should be no need to have the ClojureScript compiler index the (gigantic) node_modules directory (because the React Native packager takes care of pulling code out of there as needed). By setting the ClojureScript compiler option :npm-deps false my (start-figwheel "ios") is nearly instantaneous (whereas previously it would spend a significant chunk of time indexing node_modules). If you want to try this to see if it also works for you, you will need to patch Figwheel so that it allows false as a valid value for :npm-deps.

💥 4

Is npm-deps on by default in recent versions of the cljs compiler?


It seems to me that indexing node_modules is not a good default behavior, given that JS based tools don't do any indexing as far as I know (they just open the directory you require)


@pesterhazy Yes. I don’t know if this is a recent change, but it is definitely the case now. See case 4 in


This has to do with the compiler indexing things in node_modules, presumably so that the compiler can itself directly make use of code in there. So, the right thing to do appears to be to turn it off, unless you are doing something that actually makes use of that feature.


For my project, disabling it seems to have no ill effects, and I’m getting back, say 20 to 40 seconds (I haven’t actually measured it)


Oh, neat. I bet I could save some time on it too, then.


I'd love to use :npm-deps for managing things, rather than package.json. It just hasn't proved reliable yet.


An interesting case, I suppose, is when you actually want to use :npm-deps to consume some library and have it go through Closure (per, but if you aren’t doing that, then all of the other stuff in node_modules is really there for the packager to dredge through, right?


Having all the used deps go through Closure is a good thing, isn't it? I'd think, in the near future, we should all be doing it.


Aside from managing the deps in your project.clj (or whatever) and having easy require access to the packages, that's the next biggest sell. More optimization.


If we can get everything to go through Closure, yes, that would definitely be great. I suspect that is essentially the “don’t embrace the packager” approach.


I timed it on my system (an older 2012 Mac Pro), and disabling :npm-deps saves me 45 seconds when doing (start-figwheel "ios")


@mfikes You might consider noting that in the PR as well.


Oh, the PR for Figwheel is one that needs to happen anyway. But, I do think we need a re-natal PR to ultimately change the default project.clj that gets set up to include this config.


Good thinking.


I’ll add a note in the Figwheel PR though, just to prod Bruce along 🙂




Thanks for doing this @mfikes. Just tried it on the project I’m working on for android and it took ~25 seconds without and with your patch. But maybe I’m running it wrong: I’ve started the emulator and Metro bundler and then I fired up the REPL via CIDER while in the project dir. Once it came up, I ran (start-figwheel "android"). Originally I had lein-figwheel “0.5.14” installed. My project’s node_modules directory has 687 modules installed:

$ ls -1 node_modules/ | wc -l


@dotemacs Are you running ClojureScript 1.10.238?


(The :npm-deps false is a 1.10.238 new feature.)


ah, good point… my bad… Installed 1.10.238 and that took it down a few seconds!


Around 20 second mark instead of 25 seconds


@dotemacs After having tried that, it would be interesting to see if a second startup is much faster now. For me (start-figwheel "ios") drops from around 45 seconds to being instant (maybe 1 or 2 seconds).