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. Markdown · JSON
Dual (CommonJS + ESM) Dual package on paper — require() failed in our runtime test
rollup-plugin-dts declares both a CommonJS entry and a native ESM entry (ESM added in 3.0.0), but require("rollup-plugin-dts") failed on every Node.js version in our probe: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescri…. That usually means a missing peer dependency, a browser-only global, or a package that refuses to be loaded with require(); see the runtime table below.
What to do
- require("rollup-plugin-dts") failed in our probe on every Node.js version (rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescri…); check the package README for peer dependencies or setup before relying on it.
- TypeScript: types are bundled; install nothing extra.
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 | ✗ failsError |
| Node.js 20 | ✗ failsError | ✗ failsError |
| Node.js 22 | ✗ failsError | ✗ failsError |
| Node.js 24 | ✗ failsError | ✗ failsError |
| Node.js 26 | ✗ failsError | ✗ failsError |
| Bun 1.4.0 | ✗ failsError | ✗ failsError |
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 * as rollupPluginDts from "rollup-plugin-dts";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("rollup-plugin-dts") failed in our probe on every Node.js version we test (rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescri…); see the runtime table.
const rollupPluginDts = require("rollup-plugin-dts");Module format by version
Derived from the type, main and exports fields of every stable release on npm, corrected where a runtime test of that version contradicted them (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 declares CommonJS and ESM builds, but require() fails at runtime. rollup-plugin-dts declares both a CommonJS entry and a native ESM entry (ESM added in 3.0.0), but require("rollup-plugin-dts") failed on every Node.js version in our probe: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescri…. That usually means a missing peer dependency, a browser-only global, or a package that refuses to be loaded with require(); see the runtime table below.
Can I require rollup-plugin-dts?
Not in practice. rollup-plugin-dts declares a CommonJS entry, but require("rollup-plugin-dts") failed on every Node.js version in our probe: rollup-plugin-dts requires the TypeScript compiler API. The installed typescript@7.0.2 does not provide it, and the `@typescript/typescri…. Check the package README for peer dependencies or setup before relying on it.
Does rollup-plugin-dts work in Bun?
Importing rollup-plugin-dts failed in Bun 1.4.0 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
- tslib 2.8.1Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
Similar popularity
- vue-template-compiler 2.7.16CommonJS
- rollup-plugin-typescript2 0.37.0CommonJS
- @fortawesome/free-solid-svg-icons 7.3.1Dual
- pnp-webpack-plugin 1.7.0CommonJS
- @oclif/config 1.18.17CommonJS
- @sveltejs/kit 2.70.3ESM-only
- sequelize 6.37.8Dual
- copyfiles 2.4.1CommonJS