canirequire

canirequireESM-only › unbuild

Is unbuild ESM-only? Can you require() it?

A unified JavaScript build system

Last verified Sep 9, 2026 against unbuild@3.6.1. JSON

ESM-only ESM-only since 0.5.6 — last CommonJS version is 0.5.5

unbuild dropped its CommonJS build in 0.5.6 (October 2021). The last version you can require() on every Node.js version, including 18 and older, is 0.5.5, published Sep 29, 2021.

require("unbuild") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.

Latest
3.6.1 (Aug 15, 2025)
Module format
ESM-only
Last CommonJS version
0.5.5
ESM-only since
0.5.6 (Oct 1, 2021)
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
219K
License
MIT

Does unbuild@3.6.1 actually load? Runtime test results

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

Runtimerequire("unbuild")import "unbuild"
Node.js 18✗ failsERR_REQUIRE_ESM✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.
Node.js 20✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.
Node.js 22✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.
Node.js 24✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.
Node.js 26✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.✗ failsError: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.
Bun 1.4✗ failserror: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.✗ failserror: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.

How to import unbuild

ES modules (import)

import unbuild from "unbuild";

CommonJS (require)

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

// Any Node.js version:
const unbuild = await import("unbuild");

// Or pin the last CommonJS release:
// npm install unbuild@0.5.5

Module format by version

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

VersionsFormatFirst published
0.5.8 – 3.6.1ESM-onlyOct 20, 2021

Frequently asked

Is unbuild ESM-only?

unbuild@3.6.1 is ESM-only. unbuild dropped its CommonJS build in 0.5.6 (October 2021). The last version you can require() on every Node.js version, including 18 and older, is 0.5.5, published Sep 29, 2021.

Which version of unbuild still supports CommonJS / require()?

0.5.5 is the last version of unbuild with a CommonJS build. Install it with "npm install unbuild@0.5.5". Every version from 0.5.6 on is ESM-only.

How do I use unbuild from a CommonJS file?

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

Does unbuild work in Bun?

Importing unbuild failed in Bun 1.4 on Sep 9, 2026: error: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescript6` fallback is not installed.

Does unbuild ship TypeScript types?

Yes. unbuild bundles its own type declarations; no @types package is needed.

Links

Other esm-only packages

Similar popularity