Fork me on GitHub
#cljsrn
<
2019-03-04
>
thheller12:03:17

@haiyuan.vinurs I created an example using reagent and react-native, without expo. https://github.com/thheller/reagent-react-native

danielneal12:03:18

@thheller thanks so much for your expo template. I've been using expo and react native for a major project for a while. I've never used shadow-cljs before and I tried it this Friday afternoon for the first time. It worked great!

👍 5
danielneal12:03:52

Also I think the source map issue is fixable - the expo template I was using before has something in that patches the metro server: https://github.com/seantempesta/expo-cljs-template/blob/master/resources/leiningen/new/expo/env/dev/user.clj#L22-L27

danielneal12:03:50

Re-natal I think does the same thing

danielneal12:03:27

To get react native to work in production mode on 0.57 there's also a patch needed to the metro bundler

danielneal12:03:15

But thanks again, the npm integration and reloading is 👌 💯, think I'll use shadow-cljs much more in future!!

thheller12:03:33

the enable source maps hack doesn't do anything anymore I think

thheller12:03:48

the regexp it tries to replace doesn't match anything in that file

thheller12:03:07

probably outdated

thheller12:03:11

didn't know source maps work when running in chrome. I'll look into that

vinurs12:03:18

@thheller thanks very much, i’ll try it later

danielneal12:03:56

@thheller I think the file moved in about v0.55 I think I have it working somewhere let me dig it out

danielneal12:03:31

(defn enable-source-maps
  []
  (println "Source maps enabled.")
  (let [path "node_modules/metro/src/Server.js"]
    (spit path
          (str/replace (slurp path) "/\\.map$/" "/main.map$/"))))

danielneal12:03:45

yeah - it's now Server.js rather than /server/index.js

danielneal12:03:53

it's useful when there's an error -> switch on debugging in chrome, pause on exceptions, pause on caught exceptions ->

thheller12:03:00

yes but it looks like its serving .map files on its own now

thheller12:03:09

don't need that regexp replace?

thheller12:03:31

might only be possible to do this using the bridge method of loading code without going through metro

thheller12:03:14

the problem is that metro just ignores the .map files when processing .js files

thheller12:03:30

so it'll only map to the JS but not the inputs that generated the JS

thheller12:03:56

doesn't seem like a high priority for them https://github.com/facebook/metro/issues/104

danielneal12:03:05

it's definitely working for me with that patch in place

danielneal12:03:27

in my current expo set up, which I don't think skips metro

thheller12:03:37

with shadow-cljs?

danielneal12:03:42

haven't tried with shadow-cljs yet

thheller12:03:51

with re-natal you are using the figwheel-bridge.js probably

danielneal12:03:52

my main project is expo / clojurescript

thheller12:03:59

that will bypass metro completely for the JS sources

danielneal12:03:07

ah yeah, that uses figwheel-bridge

thheller12:03:21

and load them later without metro in the picture