{"record":{"id":"a999a2f6ada90da6","repo":"oxc-project/oxc","slug":"big-integer-literals-are-not-available-in-the-conf","errorCode":null,"errorMessage":"Big integer literals are not available in the configured target environment.","messagePattern":"Big integer literals are not available in the configured target environment\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_transformer/src/es2020/mod.rs","lineNumber":75,"sourceCode":"    ) {\n        if self.options.optional_chaining {\n            self.optional_chaining.enter_formal_parameters(node, ctx);\n        }\n    }\n\n    fn exit_formal_parameters(\n        &mut self,\n        node: &mut FormalParameters<'a>,\n        ctx: &mut TraverseCtx<'a>,\n    ) {\n        if self.options.optional_chaining {\n            self.optional_chaining.exit_formal_parameters(node, ctx);\n        }\n    }\n\n    fn enter_big_int_literal(&mut self, node: &mut BigIntLiteral<'a>, ctx: &mut TraverseCtx<'a>) {\n        if self.options.big_int {\n            let warning = OxcDiagnostic::warn(\n                \"Big integer literals are not available in the configured target environment.\",\n            )\n            .with_label(node.span);\n            ctx.state.error(warning);\n        }\n    }\n\n    fn enter_import_specifier(\n        &mut self,\n        node: &mut ImportSpecifier<'a>,\n        ctx: &mut TraverseCtx<'a>,\n    ) {\n        if self.options.arbitrary_module_namespace_names\n            && let ModuleExportName::StringLiteral(literal) = &node.imported\n        {\n            let warning = OxcDiagnostic::warn(\n                \"Arbitrary module namespace identifier names are not available in the configured target environment.\",\n            )","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_transformer/src/es2020/mod.rs#L57-L93","documentation":"Warning raised by the oxc transformer's ES2020 pass (crates/oxc_transformer/src/es2020/mod.rs, `enter_big_int_literal`). When the ES2020 options enable `big_int` — which happens when the compile target predates ES2020 — and the traversal reaches a `BigIntLiteral` node (e.g. `123n`), the pass records this diagnostic via `ctx.state.error`. There is no way to downlevel a BigInt literal for pre-ES2020 environments (Babel likewise errors instead of transforming), so oxc reports and leaves the literal in place; running the output on an old target throws SyntaxError.","triggerScenarios":"Transforming source containing BigInt literals (`10n`, `0xFFn`, `1_000_000n`) with an oxc-transformer/oxc-transform ES target below ES2020 (options.big_int enabled, e.g. targets like chrome 60 or es2015/es2017). Each BigIntLiteral node in the program produces one error labeled with the literal's span.","commonSituations":"Browserslist/babel targets left at legacy defaults (older Safari, IE11-era configs) while dependencies or app code use `BigInt` literals; upgrading a dependency that starts shipping `n` literals without bumping the build target; using IDs stored as BigInt literals in a codebase built for old runtimes.","solutions":["Raise the build target to ES2020 or later (browserslist config, `target: 'es2020'` in oxc-transform options) so the `big_int` transform is disabled.","Replace literals with constructor calls: `BigInt('123')` works in any runtime that has BigInt; if the runtime lacks BigInt entirely, use a bigint polyfill/bn.js.","Remove the BigInt usage (use numbers or strings for IDs).","If you must stay pre-ES2020, use a dedicated bigint transform plugin (e.g. babel-plugin-transform-bigint) in a separate pass — oxc does not provide one."],"exampleFix":"// before (target: es2018)\nconst id = 9007199254740993n;\n\n// after\nconst id = BigInt('9007199254740993');","handlingStrategy":"validation","validationCode":"// Check source for BigInt literals before transforming for a pre-ES2020 target\nif (/\\b\\d+n\\b/.test(source)) {\n  throw new Error('Source contains BigInt literals; raise the target to ES2020+ or convert to BigInt(\"...\") calls');\n}","typeGuard":null,"tryCatchPattern":"// oxc-transform returns diagnostics instead of throwing — inspect them\nimport { transform } from 'oxc-transform';\nconst result = transform('foo.ts', source, { target: 'es2018' });\nif (result.errors.length > 0) {\n  for (const err of result.errors) console.error(err.message); // 'Big integer literals are not available...'\n  process.exit(1);\n}","preventionTips":["Align browserslist/compile targets with the newest syntax your dependencies ship; audit targets when upgrading deps.","Ban BigInt literals via a lint rule when targeting pre-ES2020 runtimes.","Treat returned diagnostics as fatal in build scripts instead of writing the code out."],"tags":["oxc","transformer","es2020","bigint","compile-target"],"backgroundTag":"syntax-not-supported-by-compile-target","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}