Replies: 3 comments
-
@Suero152 Hi, Thanks for posting this, The minimum ES target for TypeBox is ES2020 (so does expect the runtime to have support for the BigInt type) Note though that TypeBox doesn't use the BigInt literal syntax internally as some users have experienced issues transforming the Unfortunately, I'm not familiar with the Nakama runtime or babel transform plugins so can't provide much assistance here, but do appreciate having links and references submitted for the benefit of other users. In terms of your outlined approach, I guess it's fine if it works :) Would you like me to convert this issue into a discussion? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the speedy response, yeah you can convert into a discussion if you want, tysm for supporting this amazing lib |
Beta Was this translation helpful? Give feedback.
-
@Suero152 Hey, all good :) Will move to the issue into discussions |
Beta Was this translation helpful? Give feedback.
-
I was having some problems while trying to use the Babel transpiler with Typebox modules because it makes use of BigInts which are not supported in older vesions of JS and Babel can't transpile them, so I wasn't being able to run the code on a ES5 JS VM with Nakama.
The solution I was able to get it working was to patch (with git patches and patch-package) the library and remove the uses of BigInt on the modules I was importing. ( Like typebox/value/hash that uses BigInts )
Another solution (as stated in https://babeljs.io/docs/babel-plugin-syntax-bigint) would be to make use of the JSBI library in Typebox and eventually run babel-plugin-transform-jsbi-to-bigint to codemod it to BigInt in the future.
I'm creating this issue because someone can get into an similar problem and this may be useful somehow, also I wanted to know if my current approach is correct or it wasn't needed.
The patch I used to remove some BigInt usages: https://gist.github.com/Suero152/7508faa894f12477a5c2fec7d3a974da
Beta Was this translation helpful? Give feedback.
All reactions