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

WARNING: Identifier directly after number #14

Closed
jafri opened this issue Apr 17, 2019 · 5 comments
Closed

WARNING: Identifier directly after number #14

jafri opened this issue Apr 17, 2019 · 5 comments

Comments

@jafri
Copy link

jafri commented Apr 17, 2019

Get the following warning from building

WARNING in ./node_modules/bcrypto/lib/node/bn.js 51:17
    Module parse failed: Identifier directly after number (51:17)
    You may need an appropriate loader to handle this file type.
    |  */
    |
    > const U8_MAX = (1n << 8n) - 1n;
    | const U16_MAX = (1n << 16n) - 1n;
@pinheadmz
Copy link
Member

pinheadmz commented Apr 17, 2019

@jafri what produced this error? The regular installation/build of bcrypto for bcoin or handshake? Or was it a react build?

These are bigInt's. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt

@tynes
Copy link
Member

tynes commented Apr 17, 2019

There isn't a way to babelify BigInts. The newer versions of browsers do support them, to build with babel/webpack you will need to tell babel to exclude lib/node/bn.js

@jafri
Copy link
Author

jafri commented Apr 17, 2019

@pinheadmz just a regular installation and its just a warning, works fine.

@jafri jafri closed this as completed Apr 17, 2019
@chjj
Copy link
Member

chjj commented Apr 30, 2019

@jafri, the v8 bigint backend isn't meant to be babelified for this reason. The package browser field is meant to enforce this and fall back to the vanilla JS version:

@bradicalone
Copy link

bcrypto/lib/node/bn.js: Identifier directly after number (46:17)

44 | */
45 |

46 | const U8_MAX = (1n << 8n) - 1n;
| ^
47 | const U16_MAX = (1n << 16n) - 1n;
48 | const U32_MAX = (1n << 32n) - 1n;
49 | const U64_MAX = (1n << 64n) - 1n;

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

Successfully merging a pull request may close this issue.

5 participants