-
Notifications
You must be signed in to change notification settings - Fork 314
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
Support environments without native bigint
#1096
Comments
react-dom.development.js?61bb:24994 Download the React DevTools for a better development experience: https://fb.me/react-devtools |
to your package.json |
|
I can't do that... Its in the Transactions library from what I could find out. |
Where are you seeing the line There's this in the source Seems like the bundler you're using is incorrectly transpiling that to use |
@ahsan-javaid to use Do I need to do extra things?
|
Visit the full configuration here. Also add @babel/plugin-syntax-bigint |
@ahsan-javaid progress was made :) thank you |
Update: I was missing @babel/core, issue is not seen anymore. I'll leave this here for archive purposes. I've been having this issue for months and was manually resolving by changing the below file
But now it's not working on another system, I've also applied the solutions provided here but still the same error. Any suggestions/fix please? Did I miss something?
|
@pseudozach we had the same problems, only some browsers and the most recent ones can/would support these changes. We ended up abandoning the project because of it... So sorry, we never got a better solution than the one the team gave us... It does work! But only for some devices and browsers... |
@Filmaluco do you have specific older browsers that needed support? MDN shows all modern browsers (everything other than Internet Explorer) is supported https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt, and https://caniuse.com/bigint is showing 91% global support. This lib could be changed to use a bigint polyfill if necessary, but typically web apps that want to support older browsers configure that themselves. For example https://www.npmjs.com/package/babel-plugin-transform-bigint could be used by your web app to polyfill bigint with Any input from @blockstack/ux-team? |
I'd also be curious to hear which browsers in particular @Filmaluco has in mind that aren't supported and have blocked development. I'm certainly sorry to hear that the project was abandoned. 😕 |
@zone117x sometimes certain tools will output If you are using presets: [
[
'@babel/preset-env',
{
modules: isTestEnv ? 'commonjs' : false,
targets: isTestEnv ? { node: 'current' } : targets,
loose: false,
useBuiltIns: false,
exclude: [
'transform-async-to-generator',
'transform-regenerator',
'transform-exponentiation-operator', // this line here
],
},
],
],
``` |
@zone117x @markmhx. |
For those who use create-react-app, don't want to reject, and don't need to support IE and Android browser version <= 4.4.4, steps below should fix the issue.
Without those old browsers, |
Thanks @witwitchayakarn for the tip. Given the amount of people this is causing problems for, I'm going to re-open this issue and argue that stacks.js should use a bigint polyfill internally. Given that I initially implemented support for native bigint to begin with, I'm happy to take this on. I'd like the lib to continue supporting native |
bigint
@zone117x Glad I can help. I guess 3 months or 6 months from now, the issue will be gone when those old browsers' usage is less than 0.2%. 😀 |
holy cow this was a pain to track down in all that minimized production code. It seems it's been blocking people for a month from doing production builds of stacks apps using all the official repos, and people already abandoned the ecosystem cos of this issue. If there's a PR it might be a good idea to get it merged. |
@ahsan-javaid @zone117x any updates on the above PR? |
The `babel-plugin-transform-exponentiation-operator ` Babel plugin transforms `1n ** 1n` into `Math.pow(1n, 1n)` which doesn't work because `Math.pow` doesn't support BigInts - facebook/create-react-app#6907 (comment) The fix is to change the `"browsersList"` setting to exclude ie and old android - hirosystems/stacks.js#1096 (comment)
The `babel-plugin-transform-exponentiation-operator ` Babel plugin transforms `1n ** 1n` into `Math.pow(1n, 1n)` which doesn't work because `Math.pow` doesn't support BigInts - facebook/create-react-app#6907 (comment) This is used in `@noble/ed25519` which recently got added to `libp2p-crypto` - libp2p/js-libp2p-crypto#202 The fix is to change the `"browsersList"` setting to exclude ie and old android - hirosystems/stacks.js#1096 (comment)
The `babel-plugin-transform-exponentiation-operator ` Babel plugin transforms `1n ** 1n` into `Math.pow(1n, 1n)` which doesn't work because `Math.pow` doesn't support BigInts - facebook/create-react-app#6907 (comment) This is used in `@noble/ed25519` which recently got added to `libp2p-crypto` - libp2p/js-libp2p-crypto#202 The fix is to change the `"browsersList"` setting to exclude ie and old android - hirosystems/stacks.js#1096 (comment)
I am trying to update a project to the latest libraries, and have the following error:
"dependencies": { ... "@stacks/auth": "^2.0.1", "@stacks/connect": "^5.0.5", "@stacks/profile": "^2.0.1", "@stacks/storage": "^2.0.1", "@stacks/transactions": "^2.0.1", ... }
We were using node: 12.3.0
Updating only this libraries resulted in a error telling us we needed to use a higher version >= 12.13.0
But even inside the node JS 14.17.5
Math.pow(BigInt(2), BigInt(128)) - BigInt(1);
will result in the error:
Cannot convert a BigInt value to a number
Can someone assist?
The text was updated successfully, but these errors were encountered: