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

Error on every refresh #692

Closed conan closed 6 years ago

conan commented 6 years ago

Every time figwheel reloads code, I get the following error dumped to the console:

connect.cljs?rel=1526298312396:9
Uncaught TypeError: Cannot read property 'init' of undefined
    at G__56805__delegate (connect.cljs?rel=1526298312396:9)
    at Function.figwheel.connect.start.cljs.core.PersistentArrayMap.G__56805.cljs$lang$applyTo (connect.cljs?rel=1526298312396:9)
    at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (core.cljs:3891)
    at cljs$core$apply (core.cljs:3883)

It doesn't cause any problems that I am aware of, but I'd like to get rid of it. Unfortunately I have no idea where to start looking. Any clues?

Here's a snapshot of my console with more info:

image

conan commented 6 years ago

I load the application in my index.html by calling my init function, I'm guessing it's something to do with that; the problem only occurs on figwheel reloads though, not on initial load of the application.

bhauman commented 6 years ago

it looks like it can't find the "hanabi" namespace

I'm pretty sure that it's this line thats causing the error.

Is your init function getting called?

On Fri, Jun 1, 2018 at 8:09 AM, Conan notifications@github.com wrote:

I load the application in my index.html by calling my init function, I'm guessing it's something to do with that; the problem only occurs on figwheel reloads though, not on initial load of the application.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/692#issuecomment-393910404, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQHfJnC425UBA76t96vBrGDCW5KUwks5t4VkmgaJpZM4UWwUD .

bhauman commented 6 years ago

forgot to paste the line https://github.com/bhauman/lein-figwheel/blob/master/support/src/figwheel/env_config.clj#L29

On Fri, Jun 1, 2018 at 8:32 PM, Bruce Hauman bhauman@gmail.com wrote:

it looks like it can't find the "hanabi" namespace

I'm pretty sure that it's this line thats causing the error.

Is your init function getting called?

On Fri, Jun 1, 2018 at 8:09 AM, Conan notifications@github.com wrote:

I load the application in my index.html by calling my init function, I'm guessing it's something to do with that; the problem only occurs on figwheel reloads though, not on initial load of the application.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/692#issuecomment-393910404, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQHfJnC425UBA76t96vBrGDCW5KUwks5t4VkmgaJpZM4UWwUD .

conan commented 6 years ago

The init function is called in the index.html file like this:

<div id="app"></div>
<script src="js/compiled/app.js?cache_buster=<cache_buster>"></script>
<script>hanabi.core.init();</script>
conan commented 6 years ago

it gets run correctly because that's what kicks off the application fine, or at least it gets run on first load; it's possible it isn't being run on subsequent loads because of this error, but the application has already started up

conan commented 6 years ago

I figured this out, I had an :on-jsload option in my figwheel config in my project.clj that was looking for hanabi.user/init instead of hanabi.core/init.