bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 210 forks source link

Version 0.5.10 will not hot reload main (cljs.user namespace) #560

Closed awkay closed 7 years ago

awkay commented 7 years ago

I have the following project file, which works fine:

(defproject my-project "0.0.1"
  :description "My Project"
  :dependencies [[org.clojure/clojure "1.9.0-alpha16"]
                 [org.clojure/clojurescript "1.9.562"]
                 [org.omcljs/om "1.0.0-beta1"]
                 [awkay/untangled "1.0.0-SNAPSHOT"]]

  :source-paths ["src/main"]
  :resource-paths ["resources"]
  :clean-targets ^{:protect false} ["resources/public/js" "target" "out"]

  :plugins [[lein-cljsbuild "1.1.6"]]

  :cljsbuild {:builds
              [{:id           "dev"
                :source-paths ["src/main" "src/dev"]
                :figwheel     {:on-jsload "cljs.user/refresh"}
                :compiler     {:main          cljs.user
                               :output-to     "resources/public/js/app.js"
                               :output-dir    "resources/public/js/app"
                               :preloads      [devtools.preload]
                               :asset-path    "js/app"
                               :optimizations :none}}]}

  :profiles {:dev {:source-paths ["src/dev" "src/main"]
                   :dependencies [[binaryage/devtools "0.9.2"]
                                  [org.clojure/tools.namespace "0.3.0-alpha4"]
                                  [figwheel-sidecar "0.5.9"]]}})

With version 0.5.9: changes to src/dev/cljs/user.cljs get hot reloaded.

If I upgrade to version 0.5.10 of sidecar, then the user namespace will no longer reload when changed. The browser dev console still says "Figwheel: notified of file changes" but then no files are sent.

All other files in the project seem to work fine.

I've placed the relatively small project at https://github.com/awkay/figwheel-problem if you wanted to reproduce it locally. It is a sidecar project:

lein run -m clojure.main script/figwheel.clj
bhauman commented 7 years ago

I'm pretty sure I know what commit caused this. I think it's from trying to prevent the reloading of immutable "cljs" namespaces. So in the short term if you rename it, It should work.

On Jun 12, 2017, at 10:03 AM, Tony Kay notifications@github.com wrote:

I have the following project file, which works fine:

(defproject my-project "0.0.1" :description "My Project" :dependencies [[org.clojure/clojure "1.9.0-alpha16"] [org.clojure/clojurescript "1.9.562"] [org.omcljs/om "1.0.0-beta1"] [awkay/untangled "1.0.0-SNAPSHOT"]]

:source-paths ["src/main"] :resource-paths ["resources"] :clean-targets ^{:protect false} ["resources/public/js" "target" "out"]

:plugins [[lein-cljsbuild "1.1.6"]]

:cljsbuild {:builds [{:id "dev" :source-paths ["src/main" "src/dev"] :figwheel {:on-jsload "cljs.user/refresh"} :compiler {:main cljs.user :output-to "resources/public/js/app.js" :output-dir "resources/public/js/app" :preloads [devtools.preload] :asset-path "js/app" :optimizations :none}}]}

:profiles {:dev {:source-paths ["src/dev" "src/main"] :dependencies [[binaryage/devtools "0.9.2"] [org.clojure/tools.namespace "0.3.0-alpha4"] [figwheel-sidecar "0.5.9"]]}}) With version 0.5.9: changes to src/dev/cljs/user.cljs get hot reloaded.

If I upgrade to version 0.5.10 of sidecar, then the user namespace will no longer reload when changed. The browser dev console still says "Figwheel: notified of file changes" but then no files are sent.

All other files in the project seem to work fine.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

bhauman commented 7 years ago

Here's the bug:

https://github.com/bhauman/lein-figwheel/blob/49527dfce887599d4f1b4ddf0f87aa74ea3c45da/support/src/figwheel/client/file_reloading.cljs#L77

I'm filtering anything that starts with cljs. for reload. Maybe this is too much.

awkay commented 7 years ago

Thanks Bruce! Renaming wasn't a bad solution. I often wonder if the Clojure community's general tendency to ignore the java standard of including a domain name in whatever you write/publish isn't penny wise (shorter ns declarations???) and pound foolish (bugs on conflicts in random libraries).