{"id":21901,"library":"rollup-endpoint","title":"rollup-endpoint","description":"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.","status":"active","version":"0.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/mindeavor/rollup-endpoint","tags":["javascript"],"install":[{"cmd":"npm install rollup-endpoint","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-endpoint","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-endpoint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundler needed at runtime","package":"rollup","optional":false},{"reason":"Required as a peer to mount the endpoint","package":"express","optional":false}],"imports":[{"note":"Package exports a default object with a serve method. The wrong pattern uses destructuring which is incorrect when require() returns a function prototype.","wrong":"const { serve } = require('rollup-endpoint')","symbol":"default","correct":"import rollupEndpoint from 'rollup-endpoint'"},{"note":"serve is a method on the default export, not a named export.","wrong":"const serve = require('rollup-endpoint').serve;","symbol":"serve","correct":"import rollupEndpoint from 'rollup-endpoint'; const { serve } = rollupEndpoint;"},{"note":"CommonJS must import the whole module object, then destructure serve separately.","wrong":"const { rollupEndpoint } = require('rollup-endpoint');","symbol":"require pattern","correct":"const rollupEndpoint = require('rollup-endpoint');"}],"quickstart":{"code":"// server.js\nconst rollupEndpoint = require('rollup-endpoint');\nconst express = require('express');\nconst app = express();\n\napp.get('/bundle.js', rollupEndpoint.serve({\n  entry: require('path').join(__dirname, 'client', 'main.js'),\n  plugins: process.env.NODE_ENV === 'production'\n    ? [\n        require('rollup-plugin-buble')(),\n        require('rollup-plugin-uglify')()\n      ]\n    : []\n}));\n\napp.listen(3000, () => console.log('Server running on port 3000'));\n","lang":"javascript","description":"Creates an Express server that serves a Rollup-bundled JavaScript file from client/main.js, with production plugins for transpilation and minification."},"warnings":[{"fix":"Ensure NODE_ENV=production in production environments. For development, consider using nodemon or similar to restart automatically on changes.","message":"Cache 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.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use 'es' for ES module format instead of 'es6'.","message":"The generateOptions.format option 'es6' is deprecated in Rollup >=0.47.0 and may cause silent failures or unexpected behavior.","severity":"deprecated","affected_versions":">=0.1.0 <1.0.0"},{"fix":"Create a new plugin instance for each request by using a factory function, or ensure plugins are stateless.","message":"Rollup 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).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Pin Rollup to version 1.x (e.g., \"rollup\": \"^1.0.0\") or update to a compatible package.","message":"Rollup 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.","severity":"breaking","affected_versions":">=0.1.0 <1.0.0"},{"fix":"Use 'input' instead of 'entry' when specifying the bundle entry point.","message":"The '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.","severity":"deprecated","affected_versions":">=0.1.0 <1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: npm install rollup --save","cause":"Missing peer dependency 'rollup' required by rollup-endpoint.","error":"Cannot find module 'rollup'"},{"fix":"Use: const rollupEndPoint = require('rollup-endpoint'); app.get('/bundle.js', rollupEndPoint.serve({...}));","cause":"Incorrect import pattern; likely using destructuring on require.","error":"TypeError: rollupEndPoint.serve is not a function"},{"fix":"Use import syntax or rename file to .cjs to force CommonJS.","cause":"Running the module in an ESM environment (e.g., Node.js with type: module) where require is not available.","error":"ReferenceError: require is not defined"},{"fix":"Replace 'entry' with 'input' in the options object.","cause":"Using the deprecated 'entry' option instead of 'input' with Rollup >=1.","error":"Error: `options.input` must be a string or array of strings"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}