Registry / web-framework / rollup-endpoint

rollup-endpoint

JSON →
library0.2.2jsnpmunverified

Serve a Rollup-bundled JavaScript file directly from an Express.js endpoint with minimal configuration. Current stable version is 0.2.2. It builds bundles on the fly during development and enables caching with gzip in production via the NODE_ENV environment variable. Differentiators include zero build step integration, automatic caching, and support for all Rollup options including plugins and generate options. Ideal for rapid prototyping or simple SPAs without a separate build system.

npm install rollup-endpoint
INSTALL
IMPORT
SIG · ROLLUP-ENDPOINT
R
rollup-endpoint
web-frameworkjavascriptv0.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import rollupEndpoint from 'rollup-endpoint'
const { serve } = require('rollup-endpoint')
Package exports a default object with a serve method. The wrong pattern uses destructuring which is incorrect when require() returns a function prototype.
serve
import rollupEndpoint from 'rollup-endpoint'; const { serve } = rollupEndpoint;
const serve = require('rollup-endpoint').serve;
serve is a method on the default export, not a named export.
require pattern
const rollupEndpoint = require('rollup-endpoint');
const { rollupEndpoint } = require('rollup-endpoint');
CommonJS must import the whole module object, then destructure serve separately.

Creates an Express server that serves a Rollup-bundled JavaScript file from client/main.js, with production plugins for transpilation and minification.

// server.js const rollupEndpoint = require('rollup-endpoint'); const express = require('express'); const app = express(); app.get('/bundle.js', rollupEndpoint.serve({ entry: require('path').join(__dirname, 'client', 'main.js'), plugins: process.env.NODE_ENV === 'production' ? [ require('rollup-plugin-buble')(), require('rollup-plugin-uglify')() ] : [] })); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
gotchaCache only works when NODE_ENV is set to 'production'. Without it, the bundle is rebuilt on every request in development. This can cause high CPU usage and slow responses.
fix
Ensure NODE_ENV=production in production environments. For development, consider using nodemon or similar to restart automatically on changes.
affects: >=0.1.0
deprecatedThe generateOptions.format option 'es6' is deprecated in Rollup >=0.47.0 and may cause silent failures or unexpected behavior.
fix
Use 'es' for ES module format instead of 'es6'.
affects: >=0.1.0 <1.0.0
gotchaRollup plugins must be configured per request; if you pass a plugin array in the options, it will be reused across requests. This can lead to memory leaks if plugins hold state (e.g., rollup-plugin-visualizer).
fix
Create a new plugin instance for each request by using a factory function, or ensure plugins are stateless.
affects: >=0.1.0
breakingRollup 2.0 uses ES module syntax for configuration and options. The package rollup-endpoint (pre-Rollup 2) expects the CommonJS API. Using Rollup >=2 may break the bundle generation.
fix
Pin Rollup to version 1.x (e.g., "rollup": "^1.0.0") or update to a compatible package.
affects: >=0.1.0 <1.0.0
deprecatedThe 'entry' option has been renamed to 'input' in Rollup version 1.0.0 and later. Using 'entry' will now throw an error or be ignored.
fix
Use 'input' instead of 'entry' when specifying the bundle entry point.
affects: >=0.1.0 <1.0.0
Errors
Common errors & fixes
Cannot find module 'rollup'
Missing peer dependency 'rollup' required by rollup-endpoint.
fix
Run: npm install rollup --save
TypeError: rollupEndPoint.serve is not a function
Incorrect import pattern; likely using destructuring on require.
fix
Use: const rollupEndPoint = require('rollup-endpoint'); app.get('/bundle.js', rollupEndPoint.serve({...}));
ReferenceError: require is not defined
Running the module in an ESM environment (e.g., Node.js with type: module) where require is not available.
fix
Use import syntax or rename file to .cjs to force CommonJS.
Error: `options.input` must be a string or array of strings
Using the deprecated 'entry' option instead of 'input' with Rollup >=1.
fix
Replace 'entry' with 'input' in the options object.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies
rolluprequiredCore bundler needed at runtime
expressrequiredRequired as a peer to mount the endpoint
Agent activity
4 hits · last 30 days
node
4
Resources