You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the conversation I saw in Discord I just wanted to call out that this repo shouldn't set any polyfills like btoa/atob, textencoder, and so on for the user of the package. It's fine to use those inside the example project, but they should not be set in the code of the package. For example you're providing buffer in dist/main.js but you should actually be relying on the user's global.buffer (or lack thereof, and then throw).
Polyfills can be handled as a matter of documentation, for example forewarning the user that they will need those polyfills and providing example code for how to use the polyfills.
In our react native projects at TBD we're using react-native-quick-crypto , react-native-quick-base64,fastestsmallesttextencoder, react-native-bignumber, @craftzdog/react-native-buffer, and stream-browserify. We are avoiding browserify packages in general, and JS based polyfills where possible. A native C++ implementation seems lacking for streams and text encoding in the community, which we hope can be addressed by us or the community at a later point.
The text was updated successfully, but these errors were encountered:
shamilovtim
changed the title
Polyfills should be set on the user's project not in this dependency
Polyfills should be set in the user's project not in this package
May 31, 2023
Means I have to remove those polyfills, remove browserify, and let the user provide its own global polyfills, else throw errors. Can you please point me to a TBD repo where you're doing react-native stuff?
As for the missing C++ modules, maybe this is a starting point:
Based on the conversation I saw in Discord I just wanted to call out that this repo shouldn't set any polyfills like btoa/atob, textencoder, and so on for the user of the package. It's fine to use those inside the example project, but they should not be set in the code of the package. For example you're providing buffer in
dist/main.js
but you should actually be relying on the user'sglobal.buffer
(or lack thereof, and thenthrow
).Polyfills can be handled as a matter of documentation, for example forewarning the user that they will need those polyfills and providing example code for how to use the polyfills.
In our react native projects at TBD we're using
react-native-quick-crypto
,react-native-quick-base64
,fastestsmallesttextencoder
,react-native-bignumber
,@craftzdog/react-native-buffer
, andstream-browserify
. We are avoidingbrowserify
packages in general, and JS based polyfills where possible. A native C++ implementation seems lacking for streams and text encoding in the community, which we hope can be addressed by us or the community at a later point.The text was updated successfully, but these errors were encountered: