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. Markdown · JSON
Dual (CommonJS + ESM) Dual package on paper — require() failed in our runtime test
@rollup/plugin-typescript declares both a CommonJS entry and a native ESM entry (ESM added in 9.0.0), but require("@rollup/plugin-typescript") failed on every Node.js version in our probe: TypeError: Cannot read properties of undefined (reading 'ES2015'). 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-typescript") failed in our probe on every Node.js version (TypeError: Cannot read properties of undefined (reading 'ES2015')); check the package README for peer dependencies or setup before relying on it.
- TypeScript: types are bundled; install nothing extra.
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.0 | ✗ 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 * as pluginTypescript from "@rollup/plugin-typescript";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("@rollup/plugin-typescript") failed in our probe on every Node.js version we test (TypeError: Cannot read properties of undefined (reading 'ES2015')); see the runtime table.
const pluginTypescript = require("@rollup/plugin-typescript");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 (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 declares CommonJS and ESM builds, but require() fails at runtime. @rollup/plugin-typescript declares both a CommonJS entry and a native ESM entry (ESM added in 9.0.0), but require("@rollup/plugin-typescript") failed on every Node.js version in our probe: TypeError: Cannot read properties of undefined (reading 'ES2015'). 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-typescript?
Not in practice. @rollup/plugin-typescript declares a CommonJS entry, but require("@rollup/plugin-typescript") failed on every Node.js version in our probe: TypeError: Cannot read properties of undefined (reading 'ES2015'). Check the package README for peer dependencies or setup before relying on it.
Does @rollup/plugin-typescript work in Bun?
Importing @rollup/plugin-typescript failed in Bun 1.4.0 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
- 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
- stylus 0.64.0CommonJS
- babel-plugin-named-asset-import 0.3.8CommonJS
- @angular-devkit/build-angular 22.1.7CommonJS
- eslint-config-standard 17.1.0CommonJS
- @storybook/node-logger 8.6.14Dual
- @testing-library/react-hooks 8.0.1CommonJS
- figlet 1.11.4Dual
- react-scripts 5.0.1No entry