clojureclojurescriptfigwheel

How can I get figwheel to reload a website when a checkout dependency changes?


I'm working on two related web applications that both depend on a third local project for the code they have in common.

How can I get figwheel to rebuild and reload the code when the checkout dependency is edited?


Solution

  • At the moment, Figwheel doesn't automatically detect leiningen checkouts. You need to add the source paths of your checkout sources directly to your cljsbuild :source-paths. For example, if you had something like

      :cljsbuild {:builds [{:id           "dev"
                            :source-paths ["src" "dev"]
                            :figwheel     {:on-jsload       'my.main/mount-gui}
                            :compiler     {:output-to       ...
                                           :output-dir      ...
                                           :main            'my.main
                                          ...
    

    then you would need to change it to

      :cljsbuild {:builds [{:id           "dev"
                            ;; Add checkouts path here
                            :source-paths ["src" "dev" "checkouts/my-project/src"]
                            :figwheel     {:on-jsload       'my.main/mount-gui}
                            :compiler     {:output-to       ...
                                           :output-dir      ...
                                           :main            'my.main
                                          ...
    

    Once figwheel knows about your checkout project source paths, it should automatically recompile after any changes, and reload the code, as it would for code in your main project.

    I'm working on a pull request to fix this issue, which should make it work automatically in the future.