canirequire › ESM-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.
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.
| Runtime | require("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.5Module format by version
Derived from the type, main and exports fields of every stable release on npm (97 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 0.5.8 – 3.6.1 | ESM-only | Oct 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
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- vue-jest 3.0.7CommonJS
- gulp-postcss 10.0.0CommonJS
- tslint-config-prettier 1.18.0CommonJS
- karma-cli 2.0.0CommonJS
- ember-resolver 13.2.0CommonJS
- ember-cli 7.2.0CommonJS
- grunt-contrib-jshint 3.2.0CommonJS
- rollup-plugin-typescript 1.0.1CommonJS