This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
With this option from React-Native, our react-native conditional exports are respected, but issues also surface. Previously most of these were mapped to their browser version for react-native.
core-rest-pipeline/src/util/inspect.ts is importing from "node:util", need a react-native version (same as browser should be good)
core-rest-pipeline/src/util/concat.ts needs a react-native version (same as browser should be good too)
core-rest-pipeline/src/util/userAgentPlatform.ts the dynamic import await import causing react-native error compiling JS code because it puts await in an non-async context.
could we do `import {...} from "react-native" but without adding a dependency on "react-native"? maybe just need to add a typing/declared module for it
node js only policies also need react-native version: proxyPolicy. We could do no-op, instead of throwing like in browser version
we could use a copy of browser version, which would require customers to provide polyfills for the crypto API that we use, or
we could implement react-native version using the platform API if possible. I only find that Expo provides some API but extra steps are needed for bare react-native projects https://docs.expo.dev/versions/latest/sdk/crypto/
is there a polyfill package that would work with import { createHash, createHmac } from "crypto"; with some resolver configuration?
core-util/src/byteEncoding.ts is using Buffer, browser version should work too for react-native.
With this option from React-Native, our
react-native
conditional exports are respected, but issues also surface. Previously most of these were mapped to their browser version for react-native.await import
causing react-native error compiling JS code because it putsawait
in an non-async context.import from
node:` modules, we probably could make a react-native version using same code from browser version. https://github.com/Azure/azure-sdk-for-js/blob/3afccc67ad10ed922b917bdda3cbe5f277c95be1/sdk/core/logger/src/log.ts#L4crypto
import { createHash, createHmac } from "crypto";
with some resolver configuration?Buffer
, browser version should work too for react-native.