Created
December 2, 2023 09:31
-
-
Save mattiamanzati/3a4592c299f0d379e6d857ab20c9353b 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
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 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment