-
Notifications
You must be signed in to change notification settings - Fork 26
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
Open to use conditional exports instead of globalThis.Buffer? #87
Comments
For my own education do you have some links for this? Yes, though, I am open to doing this in a better way. A few points:
It might just need the |
Plug wallet for ICP https://plugwallet.ooo injects globalThis.Buffer Apparently, it is quite popular. Has 100,000 users according to Google Chrome Web Store: https://chromewebstore.google.com/detail/plug/cfbfdhimifdmdehjmkdobpcjfefblkjm
Whatever you prefer!
My bad, was not precise enough. I thought about Subpath Imports, which seem to be supported all right by bundlers. |
To confirm on your own:
|
@achingbrain Any news? Are you open to help from my end? |
Hey, yes - please open a PR with the proposed changes and we can discuss there. |
Great! |
@achingbrain So, I made a possible solution for this issue: #88 Please take a look and say what you think about it. |
@oed Just FYI, so that you are in the loop here. |
@achingbrain Please, could you have a look at the PR for moving out of globalThis.Buffer? |
Yahoo!!! |
Hey, @achingbrain recently it was discovered that some crypto wallets forcefully polypill
globalThis.Buffer
with some garbage Buffer implementations.uint8arrays
usesglobalThis.Buffer
quite extensively. I guess, the intent is to use native Node.js Buffer, not some polyfill. How do you think about movingBuffer
-related code behind conditional exports?Say, you could have
#alloc
which resolves to./buffer-alloc.js
whennode
-imported, and./uint8array-alloc.js
by default.Also, node.js Buffer could be found in
node:buffer
on Bun and Node.js, which makes the code a bit simpler to read, and it definitely avoids implications of globalThis pollution.The text was updated successfully, but these errors were encountered: