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

Code reloading fails if you use goog namespace #734

Open danskarda opened 5 years ago

danskarda commented 5 years ago

Example code:

(ns foo.bar
  (:require [goog]))

(js/console.log (goog/Uri. js/window.location.href))

When you change foo.bar namespace, figwheel triggers reloading of foo.bar.

Reload also refreshes goog namespace which has been already patched by figwheel. This reload removes patched function like goog.isProvided_. Consequently goog.provide("foo.bar") fails because original goog.isProvided_ correctly reports that foo.bar is already there. Since then code reloading will not work at all.

Correct behavior should be to call again boostrap-goog-base after goog reload or prevent goog reloading.

This is not huge issue however it can become a nasty surprise. When reloading suddenly stops working, your first reaction is to suspect your latest upgrade of figwheel/cider/nrepl/... rather then change in your namespace dependencies.