canirequire

canirequireDual (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.

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
License
MIT

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.

Runtimerequire("@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).

VersionsFormatFirst published
9.0.0 – 12.3.0Dual (CommonJS + ESM)Oct 10, 2022
2.0.0 – 8.5.0CommonJSDec 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

Similar popularity