mhzed / react-native-sm-transformer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Transformer not working since RN 0.43

rodrigopivi opened this issue · comments

commented

After updating to RN 0.43, when i try to start the RN packager using a custom transformer like:

node node node_modules/react-native/local-cli/cli.js start --transformer node_modules/react-native-sm-transformer --skipflow"

I get a error at the packager output:

TransformError: /Users/rodrigo/Trabajo/goldfingr/mobile/index.ios.js: transformer.transform is not a function

Is there any update on this?

commented

a workaround is using webpack with haul instead of rn packager

@rodrigopivi ah, neat! I haven't seen haul. I'll look into that. For now I removed the custom transformer. I'll set up webpack as soon as I get annoyed because I don't have source maps. Haha

Thanks!

I don't have time to fix this myself right now, but in case anybody right now wants to work on it, it's because of an API break in react-native/packager/transformer.js. It shouldn't be super hard to fix, just change module.exports to module.exports.transform and twiddle the arguments from {data: {filename: string}}, callback to src, filename, options. Only thing is figuring out how they refactored the callback argument into react-ative/packager/src/JSTransformer/worker/worker.js

I fix by your way. it works without error, but it map to a wrong line.

Are there any updates on this?

TS debugging in RN likely won't work at all until this React Native issue with transformers is resolved.

@oskarsliukis @Moskize91

Does anyone have a workaround for this yet? How is it that this has been broken for so long, and react-native hasn't fixed it yet?

The code taps into the internals of react-native which obviously has changed in the subsequent versions, so the breakage of this little utility is kind of inevitable.
Follow the links in comments above should point you to solutions.
I will mark this project as deprecated to avoid confusion in the future.