From Cider, in Emacs, is there a way to restart Figwheel to detect new dependencies?

375 Views Asked by At

I added a new dependency to my Clojurescript app, and I want to know if I can run a function, maybe something like (restart-figwheel) to restart Figwheel. I read you have to restart Figwheel to detect new dependencies.

1

There are 1 best solutions below

2
Tim X On

At this time, I don't think you can do this. You need to quit your current figwheel session and restart in order to pick up new dependencies added to your :dependencies in your project.clj file. In fact, the figwheel docs also recommend running lein clean before you restart figwheel to be sure you don't end up with some old code.

I think this functionality is on the roadmap, but is not a high priority. There is considerable complexity in being able to have this functionality work reliably - especially if you add in the complexity of different repl environments (such as using piggyback, and cider with figwheel).

Note that this limitaiton is just with :dependency items in the project.clj. You can add :require lines in your cljs files dynamically and have them picked up (asusming the library is already in the dependencies list of course).

I suspect part of the compicaiton is ensuring the classpath is updated and that all processes already running which use the classpath are somehow updated and making sure all loaded classes are reloaded in case the dependency changes the dependencies of those loaded classes to keep things consistent.