Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfills should be set in the user's project not in this package #1

Open
shamilovtim opened this issue May 31, 2023 · 2 comments
Open

Comments

@shamilovtim
Copy link

shamilovtim commented May 31, 2023

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.

@shamilovtim 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
@pax-k
Copy link
Owner

pax-k commented May 31, 2023

@shamilovtim Thank you for this!

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:

Unfortunately I don't have time to pursue this, but would be fun to try and pick it up when I can

@shamilovtim
Copy link
Author

@pax-k we don't have the authorization to open that repo yet but I can get you anything you need code wise if you DM me on Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants