nodejs / readable-stream

Node-core streams for userland
https://nodejs.org/api/stream.html
Other
1.03k stars 228 forks source link

FR: Avoid using bigint literal syntax to target older browsers #541

Open mman opened 1 month ago

mman commented 1 month ago

One of my projects targets very old specialised browsers, and when readable-stream dependency is brought in the webpack produced code fails to run because of SyntaxError here:

https://github.com/nodejs/readable-stream/blob/a2e9aedf4aeee4a5e4d8efcb175edb67e2817eaa/src/errors.js#L339-L340

Turns out that specialised browser based on WebKit can not parse bigint literals.

I'm not sure if I am missing something but I was not able to find a solution to transpile the bigint literals correctly to target older browsers.

But turns out that the fix could be to avoid bigint literal and use BigInt constructor.

mman commented 1 month ago

Attempt to address this cleanly here: https://github.com/nodejs/readable-stream/pull/542