canirequire › Dual (CommonJS + ESM) › rollup-plugin-dts
Is rollup-plugin-dts ESM-only? Can you require() it?
A rollup plugin that will bundle up your .d.ts definition files.
Last verified Sep 9, 2026 against rollup-plugin-dts@6.5.1. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
rollup-plugin-dts publishes both a CommonJS entry and a native ESM entry (ESM added in 3.0.0). require("rollup-plugin-dts") and import "rollup-plugin-dts" both work on every supported Node.js version and in Bun.
Does rollup-plugin-dts@6.5.1 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("rollup-plugin-dts") from a CommonJS file and import "rollup-plugin-dts" from an ES module.
| Runtime | require("rollup-plugin-dts") | import "rollup-plugin-dts" |
|---|---|---|
| Node.js 18 | ✗ 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 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. |
A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.
How to import rollup-plugin-dts
ES modules (import)
import rollupPluginDts from "rollup-plugin-dts";CommonJS (require)
const rollupPluginDts = require("rollup-plugin-dts");Module format by version
Derived from the type, main and exports fields of every stable release on npm (81 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 3.0.1 – 6.5.1 | Dual (CommonJS + ESM) | Mar 7, 2021 |
| 3.0.0 | ESM-only | Mar 6, 2021 |
| 1.1.3 – 2.0.1 | CommonJS | Jun 21, 2019 |
Frequently asked
Is rollup-plugin-dts ESM-only?
rollup-plugin-dts@6.5.1 ships CommonJS and ESM builds. rollup-plugin-dts publishes both a CommonJS entry and a native ESM entry (ESM added in 3.0.0). require("rollup-plugin-dts") and import "rollup-plugin-dts" both work on every supported Node.js version and in Bun.
Can I require rollup-plugin-dts?
Yes. rollup-plugin-dts ships a CommonJS entry, so require("rollup-plugin-dts") works on every Node.js version, alongside the native ESM entry for import.
Does rollup-plugin-dts work in Bun?
Importing rollup-plugin-dts 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 rollup-plugin-dts ship TypeScript types?
Yes. rollup-plugin-dts bundles its own type declarations; no @types package is needed.
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
Similar popularity
- semantic-release 25.0.9ESM-only
- vue-template-compiler 2.7.16CommonJS
- rollup-plugin-typescript2 0.37.0CommonJS
- pnp-webpack-plugin 1.7.0CommonJS
- sequelize 6.37.8Dual
- copyfiles 2.4.1CommonJS
- vue-loader 17.4.2CommonJS
- karma-jasmine-html-reporter 2.3.0CommonJS