snowflake icon indicating copy to clipboard operation
snowflake copied to clipboard

Not able to debug w/ Chrome

Open bartonhammond opened this issue 8 years ago • 8 comments

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

bartonhammond avatar Nov 15 '16 18:11 bartonhammond

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.

wookiem avatar Nov 15 '16 19:11 wookiem

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

wookiem avatar Jan 26 '17 21:01 wookiem

Wow! Thanks!

On Jan 26, 2017 3:04 PM, "wookiem" [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bartonhammond/snowflake/issues/164#issuecomment-275513115, or mute the thread https://github.com/notifications/unsubscribe-auth/ABORPJ4ud--c93gnqNz2N0VqNNEgClBzks5rWQpYgaJpZM4Ky48D .

bartonhammond avatar Jan 26 '17 23:01 bartonhammond

@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 avatar Feb 27 '17 11:02 siemiatj

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

bartonhammond avatar Feb 27 '17 22:02 bartonhammond

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.

ghost avatar Feb 28 '17 17:02 ghost

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).

siemiatj avatar Feb 28 '17 22:02 siemiatj

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

astapinski avatar Mar 18 '17 19:03 astapinski