vulpemventures / liquidjs-lib

A javascript Liquid library for node.js and browsers.
MIT License
24 stars 15 forks source link

Use Buffer polyfill for the browser #87

Open Janaka-Steph opened 1 year ago

Janaka-Steph commented 1 year ago

Node Buffer only works in the browser with a polyfill, it is not good practice to expect the client to have it. Also it should fix an issue we have with Cypress on tdex-app. From my research we can use this one for browser https://github.com/feross/buffer. We check the environment and use this lib or Node Buffer accordingly.

@tiero @louisinger

tiero commented 1 year ago

We follow BitcoinJs here, so not sure if makes sense to diverge.

I guess the rationale behind is that BitcoinJS maintainers do not need to be responsible for polyfills of others and let users do the appropriate due diligence?

Janaka-Steph commented 1 year ago

I think it's also that JS developers took the bad habit to rely on Webpack polyfills

tiero commented 1 year ago

The "modern" way would be to move to Uint8Array, where Buffer is a superset now. I am a bit afraid to diverge from bitcoinJS

bordalix commented 1 year ago

It's not working with React Native due to this.