canirequire › Dual (CommonJS + ESM) › big.js
Is big.js ESM-only? Can you require() it?
A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic
Last verified Sep 9, 2026 against big.js@7.0.1. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
big.js publishes both a CommonJS entry and a native ESM entry (ESM added in 6.2.0). require("big.js") and import "big.js" both work on every supported Node.js version and in Bun.
Does big.js@7.0.1 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("big.js") from a CommonJS file and import "big.js" from an ES module.
| Runtime | require("big.js") | import "big.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 big.js
ES modules (import)
import bigJs from "big.js";CommonJS (require)
const bigJs = require("big.js");Module format by version
Derived from the type, main and exports fields of every stable release on npm (36 versions; the newest 36 shown).
| Versions | Format | First published |
|---|---|---|
| 6.2.0 – 7.0.1 | Dual (CommonJS + ESM) | Jun 4, 2022 |
| 2.0.0 – 6.1.1 | CommonJS | May 13, 2013 |
Frequently asked
Is big.js ESM-only?
big.js@7.0.1 ships CommonJS and ESM builds. big.js publishes both a CommonJS entry and a native ESM entry (ESM added in 6.2.0). require("big.js") and import "big.js" both work on every supported Node.js version and in Bun.
Can I require big.js?
Yes. big.js ships a CommonJS entry, so require("big.js") works on every Node.js version, alongside the native ESM entry for import.
Does big.js work in Bun?
Yes. import "big.js" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does big.js ship TypeScript types?
Not bundled. Install the community types with "npm install -D @types/big.js".
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