canirequire › Dual (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.
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.
| Runtime | require("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).
| Versions | Format | First published |
|---|---|---|
| 2.0.0 – 3.0.0 | Dual (CommonJS + ESM) | Jun 29, 2022 |
| 0.0.1 – 1.1.1 | CommonJS | Sep 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
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- rollup-plugin-livereload 2.0.5CommonJS
- ember-ajax 5.1.2CommonJS
- mocha-lcov-reporter 1.3.0CommonJS
- @oclif/dev-cli 1.26.10CommonJS
- ember-disable-prototype-extensions 1.1.3CommonJS
- gulp-minify-css 1.2.4CommonJS
- tsdx 2.0.0ESM-only
- jasmine-node 3.0.0CommonJS