dd-sdk-reactnative icon indicating copy to clipboard operation
dd-sdk-reactnative copied to clipboard

Add support for react-native-web

Open onlyanegg opened this issue 3 years ago • 8 comments

Is your feature request related to a problem? Please describe. The react-native-web build does not work

Describe the solution you'd like Support react-native-web

Describe alternatives you've considered Currently I'm mocking DdSdk and other objects in the web build with a webpack alias. I could try writing code to make requests either with the browser SDK or an http client. But it think it would make more sense if it lived in here, even if it were basically a proxy to the browser SDK.

onlyanegg avatar Sep 16 '22 03:09 onlyanegg

Hi @onlyanegg, thanks for reaching out on this topic!

It is in our backlog, but it isn't places on the roadmap yet. In the meantime I would suggest that you try writing a proxy to the browser SDK for the web part.

louiszawadzki avatar Sep 16 '22 08:09 louiszawadzki

Ok, thank you :)

onlyanegg avatar Sep 16 '22 14:09 onlyanegg

+1 on this

I've been using a custom cross-platform abstraction -- and I'm very glad to have the functionality I am able (thanks!) But I will say that it's been quite difficult at times, to keep things in aligned

After a couple bugs slipped in, I've started to ensure that any update includes an exhaustive accounting of configuration changes / types def updates to ensure consistency between the platforms.

Even if a fully fledged solution doesn't make it onto the roadmap this time around, it would be tremendously useful to start aligning the APIs.

API Mismatch Summary

Native- vs web-specific config

  • only relevant to particular platform <-- perfectly legit, but ideally distinct from possibly similar sounding options
    • eg nativeCrashReportEnabled
  • seemingly missing feature
    • eg version (recently added!)

Overlapping config

  • same key / same value <-- this is the dream 😄
  • different key / same value <-- requires some aliasing, but not too bad
    • eg service vs serviceName
  • same or slightly different key / slightly different value 🤕
    • eg firstPartyHosts vs allowedTracingOrigins or siteParameter vs site
  • different key / same value, BUT unclear if features actually overlap 🤔
    • eg trackErrors vs forwardErrorsToLogs

Misc Other Issues

  • Method mismatch - names but also sync vs async
  • Companion libraries eg @datadog/browser-logs @datadog/mobile-react-navigation
  • CI / SourceMap orchestration

leggomuhgreggo avatar Oct 15 '22 00:10 leggomuhgreggo

Hey, @leggomuhgreggo! Would you be open to sharing your abstraction? That could be super useful for me (and maybe others?) at least as a reference.

onlyanegg avatar Oct 25 '22 18:10 onlyanegg

@onlyanegg the abstraction is a library in a private monorepo, but I threw the raw code in a repo here.

leggomuhgreggo avatar Oct 30 '22 20:10 leggomuhgreggo

Thanks, @leggomuhgreggo!

onlyanegg avatar Dec 05 '22 18:12 onlyanegg

Updated the example x-platform RUM client repo

leggomuhgreggo avatar Nov 08 '23 01:11 leggomuhgreggo

Hey, @louiszawadzki! I just wanted to bump this. I'm having to do a bit of a refactor to our implementation because of and Expo update. Has supporting web in this lib gained any traction?

onlyanegg avatar Mar 12 '24 14:03 onlyanegg