# Is @rollup/plugin-typescript ESM-only? Can you require() it?

> @rollup/plugin-typescript@12.3.0 declares CommonJS and ESM builds, but require() fails at runtime. Dual package on paper — require() failed in our runtime test.

Seamless integration between Rollup and TypeScript.

Last verified Sep 9, 2026 against @rollup/plugin-typescript@12.3.0.

@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

1. 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.
2. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 12.3.0 (Oct 23, 2025)
- Module format: Dual (CommonJS + ESM)
- Last CommonJS version: 12.3.0
- Native ESM since: 9.0.0
- TypeScript types: bundled
- Node engines: >=14.0.0
- Weekly downloads: 2.4M
- License: MIT

## Runtime test results for @rollup/plugin-typescript@12.3.0

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 | fails (TypeError) | fails (TypeError) |
| Node.js 20 | fails (TypeError) | fails (TypeError) |
| Node.js 22 | fails (TypeError) | fails (TypeError) |
| Node.js 24 | fails (TypeError) | fails (TypeError) |
| Node.js 26 | fails (TypeError) | fails (TypeError) |
| Bun 1.4.0 | fails (TypeError) | fails (TypeError) |

## How to import @rollup/plugin-typescript

ES modules:

```js
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:

```js
// 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 (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

- [@rollup/plugin-typescript on npm](https://www.npmjs.com/package/@rollup/plugin-typescript)
- [Source repository](https://github.com/rollup/plugins)
- [HTML version](https://canirequire.com/package/@rollup/plugin-typescript/)
- [JSON version](https://canirequire.com/package/@rollup/plugin-typescript.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
