canirequire › Dual (CommonJS + ESM) › @rollup/plugin-typescript
Is @rollup/plugin-typescript ESM-only? Can you require() it?
Seamless integration between Rollup and TypeScript.
Last verified Sep 9, 2026 against @rollup/plugin-typescript@12.3.0. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
@rollup/plugin-typescript publishes both a CommonJS entry and a native ESM entry (ESM added in 9.0.0). require("@rollup/plugin-typescript") and import "@rollup/plugin-typescript" both work on every supported Node.js version and in Bun.
Does @rollup/plugin-typescript@12.3.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@rollup/plugin-typescript") from a CommonJS file and import "@rollup/plugin-typescript" from an ES module.
| Runtime | require("@rollup/plugin-typescript") | import "@rollup/plugin-typescript" |
|---|---|---|
| Node.js 18 | ✗ failsTypeError | ✗ failsTypeError |
| Node.js 20 | ✗ failsTypeError | ✗ failsTypeError |
| Node.js 22 | ✗ failsTypeError | ✗ failsTypeError |
| Node.js 24 | ✗ failsTypeError | ✗ failsTypeError |
| Node.js 26 | ✗ failsTypeError | ✗ failsTypeError |
| Bun 1.4 | ✗ failsTypeError | ✗ failsTypeError |
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-typescript
ES modules (import)
import pluginTypescript from "@rollup/plugin-typescript";CommonJS (require)
const pluginTypescript = require("@rollup/plugin-typescript");Module format by version
Derived from the type, main and exports fields of every stable release on npm (52 versions; the newest 52 shown).
| Versions | Format | First published |
|---|---|---|
| 9.0.0 – 12.3.0 | Dual (CommonJS + ESM) | Oct 10, 2022 |
| 2.0.0 – 8.5.0 | CommonJS | Dec 3, 2019 |
Frequently asked
Is @rollup/plugin-typescript ESM-only?
@rollup/plugin-typescript@12.3.0 ships CommonJS and ESM builds. @rollup/plugin-typescript publishes both a CommonJS entry and a native ESM entry (ESM added in 9.0.0). require("@rollup/plugin-typescript") and import "@rollup/plugin-typescript" both work on every supported Node.js version and in Bun.
Can I require @rollup/plugin-typescript?
Yes. @rollup/plugin-typescript ships a CommonJS entry, so require("@rollup/plugin-typescript") works on every Node.js version, alongside the native ESM entry for import.
Does @rollup/plugin-typescript work in Bun?
Importing @rollup/plugin-typescript failed in Bun 1.4 on Sep 9, 2026: TypeError: undefined is not an object (evaluating 'ModuleKind.ES2015')
Does @rollup/plugin-typescript ship TypeScript types?
Yes. @rollup/plugin-typescript 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
- @angular/platform-browser-dynamic 22.1.5ESM-only
- @angular-devkit/build-angular 22.1.7CommonJS
- @oclif/plugin-help 7.0.0ESM-only
- @changesets/cli 3.0.2ESM-only
- @fortawesome/fontawesome-svg-core 7.3.1Dual
- @rollup/plugin-alias 6.0.0ESM-only
- @fortawesome/free-solid-svg-icons 7.3.1Dual
- @semantic-release/npm 13.1.5ESM-only