canirequire

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

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

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.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).

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

Similar popularity