bartonhammond/snowflake

Not able to debug w/ Chrome

bartonhammond opened this issue · 8 comments

Yeah, I've been hitting this one for months. I'm only encountering this issue in files that contain multiple global functions (e.g. redux action files). I haven't encountered this in react component files which follow the pattern of stuffing most functions inside a single global react component class declaration.

My far from ideal workaround is to move the function under test to be the last function in the file. Doing this allows you to set breakpoints within this last function.

This issue was also being tracked in react-native and someone posted solution there...

Replace
function someFn() {}
with
const someFn = () => {}

There can't be ANY functions in the source file you're trying to set a breakpoint in.

https://github.com/facebook/react-native/issues/10729

@bartonhammond I was thinking about rewriting everything to ES6 since we're transpiling with babel anyway. In fact I already did that in my project so I should be able to create a PR fairly easy.

@siemiatj Sounds good - just make another PR! Many thanks

I advise Vanilla JS if you can help it. Until the browsers (and node) add support for ES2015 imports/exports, you may be painting yourself into a corner unless you can get your binary packed up and off your plate. Just saying.

I won't agree here. We're using babel to transpile JSX anyways, and almost all examples now are written with ES6 syntax. It's still vanilla JS :) Node won't support modules probably for a while since it's problematic to implement (the last thing I heard).

Just FYI, you should try this again with RN 0.42. Evidently they refactored the source map generation, I tried it with our app in the areas where multiple functions in a file were having this issue and it seems to be fixed now.
https://medium.com/@david.aurelio/medium-fast-source-map-generation-for-react-native-ea5549007c18#.i9ru7x2ue