canirequire › Dual (CommonJS + ESM) › bignumber.js
Is bignumber.js ESM-only? Can you require() it?
A library for arbitrary-precision decimal and non-decimal arithmetic
Last verified Sep 9, 2026 against bignumber.js@11.1.5. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
bignumber.js publishes both a CommonJS entry and a native ESM entry (ESM added in 9.1.0). require("bignumber.js") and import "bignumber.js" both work on every supported Node.js version and in Bun.
Does bignumber.js@11.1.5 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("bignumber.js") from a CommonJS file and import "bignumber.js" from an ES module.
| Runtime | require("bignumber.js") | import "bignumber.js" |
|---|---|---|
| Node.js 18 | ✓ works | ✓ works |
| Node.js 20 | ✓ works | ✓ works |
| Node.js 22 | ✓ works | ✓ works |
| Node.js 24 | ✓ works | ✓ works |
| Node.js 26 | ✓ works | ✓ works |
| Bun 1.4 | ✓ works | ✓ works |
How to import bignumber.js
ES modules (import)
import bignumberJs from "bignumber.js";CommonJS (require)
const bignumberJs = require("bignumber.js");Module format by version
Derived from the type, main and exports fields of every stable release on npm (68 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 9.1.0 – 11.1.5 | Dual (CommonJS + ESM) | Aug 8, 2022 |
| 1.4.1 – 9.0.2 | CommonJS | Jun 8, 2014 |
Frequently asked
Is bignumber.js ESM-only?
bignumber.js@11.1.5 ships CommonJS and ESM builds. bignumber.js publishes both a CommonJS entry and a native ESM entry (ESM added in 9.1.0). require("bignumber.js") and import "bignumber.js" both work on every supported Node.js version and in Bun.
Can I require bignumber.js?
Yes. bignumber.js ships a CommonJS entry, so require("bignumber.js") works on every Node.js version, alongside the native ESM entry for import.
Does bignumber.js work in Bun?
Yes. import "bignumber.js" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does bignumber.js ship TypeScript types?
Yes. bignumber.js bundles its own type declarations; no @types package is needed.
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- is-finalizationregistry 1.1.1CommonJS
- fflate 0.8.3Dual
- web-streams-polyfill 4.3.0Dual
- import-in-the-middle 3.5.0CommonJS
- colorette 2.0.20Dual
- jest-validate 30.5.1Dual
- isobject 4.1.1CommonJS
- proc-log 7.0.0CommonJS