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 209 forks source link

Can't find variable: document #596

Open yenda opened 7 years ago

yenda commented 7 years ago

After upgrading figwheel-sidecar from 0.5.12 to 0.5.13. I started to get the following red screen error on Android emulator when figwheel reload occurs:

Can't find variable: document

I did a git bisect and it seems that the problem starts occuring at commit 4205abb676547477320d7a51ffd4f5e70b1cd764

Any idea what causes this ?

this is the project I am working on where I encountered this problem: https://github.com/status-im/status-react

bhauman commented 7 years ago

I'm surprised that the Android emulator is calling reload-file-in-html-env. But this is obviously the case, so it is strange that this behavior is showing up now because both versions (0.5.12 and 0.5.13) add script tags to the document in order to reload files.

bhauman commented 7 years ago

I would ask on the clojurians slack channel #cljsrn

bhauman commented 7 years ago

@yenda

It appears that figwheel-react-native does it's own shimming and stuff to make figwheel work in a React Native environment. It simply appears that things have shifted out from beneath it in this case. Adding first class support for react-native to Figwheel would be a different task altogether.

https://github.com/decker405/figwheel-react-native/blob/master/development.ios.js

jeaye commented 7 years ago

I'm running into this as well. @yenda Have you worked around it?

bhauman commented 6 years ago

I'm leaving this open so that people will find it. AFAIK right now this is a change that is not yet addressed in figwheel-react-native. Figwheel doesn't internally support ReactNative yet there is now an outstanding issue to add this functionality to figwheel proper.

https://github.com/bhauman/lein-figwheel/issues/603

The simplest solution right now is fix up https://github.com/decker405/figwheel-react-native while ReactNative support is being added to Figwheel.

bhauman commented 6 years ago

I'm currently looking into fixing this in re-natal and figwheel right now.