thheller / shadow-cljs

ClojureScript compilation made easy
https://github.com/thheller/shadow-cljs
Eclipse Public License 1.0
2.23k stars 173 forks source link

`^:dev/before-load` and `^:dev/after-load` are not invoked if there are warnings while compiling #1148

Closed ai212983 closed 9 months ago

ai212983 commented 9 months ago

Not sure if it is a bug or a feature, but it took me a while to figure out. If there are warnings during compilation, like

 ------ WARNING #1 - :fn-deprecated ---------------------------------------------
  File: /[REDACTED]/core/data_parse.cljs:54:5
 --------------------------------------------------------------------------------
   51 |
   52 | (defn parse-data-chan [data parse-transducer reduce-fn init on-progress options]
   53 |   (let [ch (a/chan 1)]
   54 |     (go

Reload hooks won't be triggered. This is unfortunate, because it is not always trivial to fix warnings for old code. Warnings for library code, like

 Warnings in Library Code:
  abs already refers to: cljs.core/abs being replaced by: taoensso.encore/abs

doesn't affect hooks.

If this is a feature it would be nice to have it documented somewhere.

thheller commented 9 months ago

It is intentional that warnings block hot-reload. Warnings are meant to be fixed, not ignored.

Pretty sure you can upgrade that particular library to get rid of the warning.

If you really must you can set :devtools {:ignore-warnings true} in the build config, but I do not recommend doing so since some warnings may actually break your code and blow up hot-reload entirely.