canirequire

canirequireDual (CommonJS + ESM) › rollup-plugin-serve

Is rollup-plugin-serve ESM-only? Can you require() it?

Serve your rolled up bundle

Last verified Sep 9, 2026 against rollup-plugin-serve@3.0.0. JSON

Dual (CommonJS + ESM) Dual package — both require() and import work

rollup-plugin-serve publishes both a CommonJS entry and a native ESM entry (ESM added in 2.0.0). require("rollup-plugin-serve") and import "rollup-plugin-serve" both work on every supported Node.js version and in Bun.

Latest
3.0.0 (Dec 1, 2023)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
3.0.0
Native ESM since
2.0.0
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
51K
License
MIT

Does rollup-plugin-serve@3.0.0 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("rollup-plugin-serve") from a CommonJS file and import "rollup-plugin-serve" from an ES module.

Runtimerequire("rollup-plugin-serve")import "rollup-plugin-serve"
Node.js 18✗ failsERR_REQUIRE_ESM✓ works
Node.js 20✓ works✓ works
Node.js 22✓ works✓ works
Node.js 24✓ works✓ works
Node.js 26✓ works✓ works
Bun 1.4✓ works✓ works

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

ES modules (import)

import rollupPluginServe from "rollup-plugin-serve";

CommonJS (require)

const rollupPluginServe = require("rollup-plugin-serve");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (22 versions; the newest 22 shown).

VersionsFormatFirst published
2.0.0 – 3.0.0Dual (CommonJS + ESM)Jun 29, 2022
0.0.1 – 1.1.1CommonJSSep 24, 2016

Frequently asked

Is rollup-plugin-serve ESM-only?

rollup-plugin-serve@3.0.0 ships CommonJS and ESM builds. rollup-plugin-serve publishes both a CommonJS entry and a native ESM entry (ESM added in 2.0.0). require("rollup-plugin-serve") and import "rollup-plugin-serve" both work on every supported Node.js version and in Bun.

Can I require rollup-plugin-serve?

Yes. rollup-plugin-serve ships a CommonJS entry, so require("rollup-plugin-serve") works on every Node.js version, alongside the native ESM entry for import.

Does rollup-plugin-serve work in Bun?

Yes. import "rollup-plugin-serve" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does rollup-plugin-serve ship TypeScript types?

Yes. rollup-plugin-serve bundles its own type declarations; no @types package is needed.

Links

Other dual (commonjs + esm) packages

Similar popularity