Created
July 6, 2023 20:05
-
-
Save mattiamanzati/430f1a5496d0fc7d943c7e86ccfbc2e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (api) { | |
api.cache(true) | |
return { | |
presets: ["babel-preset-expo"], | |
plugins: ["./scripts/babel-plugin-transform-bigint-to-jsbi"] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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