canirequire

canirequireDual (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.

Latest
11.1.5 (Jul 5, 2026)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
11.1.5
Native ESM since
9.1.0
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
53.1M
License
MIT

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.

Runtimerequire("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).

VersionsFormatFirst published
9.1.0 – 11.1.5Dual (CommonJS + ESM)Aug 8, 2022
1.4.1 – 9.0.2CommonJSJun 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

Similar popularity