Skip to content

Instantly share code, notes, and snippets.

@mattiamanzati
Created July 6, 2023 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattiamanzati/430f1a5496d0fc7d943c7e86ccfbc2e3 to your computer and use it in GitHub Desktop.
Save mattiamanzati/430f1a5496d0fc7d943c7e86ccfbc2e3 to your computer and use it in GitHub Desktop.
module.exports = function (api) {
api.cache(true)
return {
presets: ["babel-preset-expo"],
plugins: ["./scripts/babel-plugin-transform-bigint-to-jsbi"]
}
}
const syntaxBigInt = require("@babel/plugin-syntax-bigint").default
module.exports = function (babel) {
const types = babel.types
const visitor = {
BigIntLiteral(path) {
const value = path.node.value
path.replaceWith(
types.callExpression(types.identifier("BigInt"), [types.StringLiteral(value)])
)
}
}
return {
inherits: syntaxBigInt,
visitor: {
...visitor
}
}
}
{
"name": "babel-plugin-transform-bigint-to-jsbi",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment