diff --git a/config/babel-plugin-transform-bigint.js b/config/babel-plugin-transform-bigint.js new file mode 100644 index 00000000..f0aae4dd --- /dev/null +++ b/config/babel-plugin-transform-bigint.js @@ -0,0 +1,20 @@ +// babel-plugin-transform-bigint.js +module.exports = function(babel) { + const { types: t } = babel; + + return { + name: "babel-plugin-transform-bigint", + visitor: { + BigIntLiteral(path) { + const value = path.node.value; + // Replace BigInt literal with a call to BigInt constructor + path.replaceWith( + t.callExpression( + t.identifier('BigInt'), + [t.stringLiteral(value)] + ) + ); + } + } + }; +}; diff --git a/config/webpack.config.js b/config/webpack.config.js index 893f3d87..ade2de7b 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -429,6 +429,9 @@ module.exports = function (webpackEnv) { // show incorrect code and set breakpoints on the wrong lines. sourceMaps: shouldUseSourceMap, inputSourceMap: shouldUseSourceMap, + plugins: [ + [require.resolve("./babel-plugin-transform-bigint.js")] + ], }, }, // "postcss" loader applies autoprefixer to our CSS.