canirequire

canirequireESM-only › size-limit

Is size-limit ESM-only? Can you require() it?

CLI tool for Size Limit

Last verified Sep 9, 2026 against size-limit@13.0.3. JSON

ESM-only ESM-only since 10.0.0 — last CommonJS version is 9.0.0

size-limit dropped its CommonJS build in 10.0.0 (October 2023). The last version you can require() on every Node.js version, including 18 and older, is 9.0.0, published Sep 5, 2023.

On Node.js 20.19+, 22.12+ and every newer release, require("size-limit") works anyway: Node can load synchronous ES modules through require(). Verified on Node 22, 24, 26. Node.js 18 and older still fail with ERR_REQUIRE_ESM.

size-limit@13.0.3 declares engines "^22.18.0 || ^24.0.0 || >=26.0.0", so Node.js 18, 20 are outside its supported range regardless of module format.

Latest
13.0.3 (Jul 30, 2026)
Module format
ESM-only
Last CommonJS version
9.0.0
ESM-only since
10.0.0 (Oct 23, 2023)
TypeScript types
Bundled
Node engines
^22.18.0 || ^24.0.0 || >=26.0.0
Weekly downloads
1.2M
License
MIT

Does size-limit@13.0.3 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("size-limit") from a CommonJS file and import "size-limit" from an ES module.

Runtimerequire("size-limit")import "size-limit"
Node.js 18✗ failsERR_REQUIRE_ESM✓ 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 size-limit

ES modules (import)

import sizeLimit from "size-limit";

CommonJS (require)

// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const sizeLimit = require("size-limit");

// Any Node.js version:
const sizeLimit = await import("size-limit");

// Or pin the last CommonJS release:
// npm install size-limit@9.0.0

Module format by version

Derived from the type, main and exports fields of every stable release on npm (183 versions; the newest 60 shown).

VersionsFormatFirst published
10.0.0 – 13.0.3ESM-onlyOct 23, 2023
4.10.0 – 9.0.0CommonJSMar 4, 2021

Frequently asked

Is size-limit ESM-only?

size-limit@13.0.3 is ESM-only. size-limit dropped its CommonJS build in 10.0.0 (October 2023). The last version you can require() on every Node.js version, including 18 and older, is 9.0.0, published Sep 5, 2023.

Which version of size-limit still supports CommonJS / require()?

9.0.0 is the last version of size-limit with a CommonJS build. Install it with "npm install size-limit@9.0.0". Every version from 10.0.0 on is ESM-only.

How do I use size-limit from a CommonJS file?

Use a dynamic import: const mod = await import("size-limit"). On Node.js 20.19+, 22.12+ and newer, a plain require("size-limit") also works for ESM packages that do not use top-level await. Alternatively pin size-limit@9.0.0.

Does size-limit work in Bun?

Yes. import "size-limit" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does size-limit ship TypeScript types?

Yes. size-limit bundles its own type declarations; no @types package is needed.

Links

Other esm-only packages

Similar popularity