{"library":"rollup-plugin-server","title":"Rollup Development Server Plugin","description":"rollup-plugin-server is a Rollup plugin that provides a basic development server for serving bundled applications. It simplifies the development workflow by allowing developers to serve static files from specified content base directories, enabling quick testing of Rollup output in a browser. The plugin supports features like history API fallback, custom host and port configuration, and optional HTTPS serving using user-provided SSL certificates. The current stable version is 0.7.0, with no recent updates, suggesting a maintenance-mode project rather than active feature development. Its primary differentiation lies in its direct integration into the Rollup configuration for a lightweight, build-time server.","language":"javascript","status":"maintenance","last_verified":"Tue Apr 21","install":{"commands":["npm install rollup-plugin-server"],"cli":null},"imports":["import server from 'rollup-plugin-server'","server({ open: true, contentBase: 'dist' })","import fs from 'fs'; /* ... */ ssl_key: fs.readFileSync('server.key')"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import server from 'rollup-plugin-server';\nimport path from 'path';\nimport fs from 'fs';\n\n// Create a dummy entry file for Rollup to process\nconst entryFilePath = path.resolve(__dirname, 'entry.js');\nfs.writeFileSync(entryFilePath, 'console.log(\"Hello from Rollup bundle!\");');\n\n// Create a dummy dist directory and an index.html\nconst distDirPath = path.resolve(__dirname, 'dist');\nif (!fs.existsSync(distDirPath)) {\n  fs.mkdirSync(distDirPath);\n}\nconst indexHtmlPath = path.join(distDirPath, 'index.html');\nfs.writeFileSync(indexHtmlPath, '<!DOCTYPE html>\\n<html><head><title>Rollup App</title></head><body><div id=\"app\"></div><script src=\"bundle.js\"></script></body></html>');\n\nexport default {\n  input: entryFilePath,\n  output: {\n    file: path.join(distDirPath, 'bundle.js'),\n    format: 'esm'\n  },\n  plugins: [\n    server({\n      open: true, // Automatically open the browser\n      verbose: true, // Show server address in console\n      contentBase: distDirPath, // Serve files from the 'dist' directory\n      host: 'localhost',\n      port: 10001,\n      historyApiFallback: true // Serve index.html for 404s\n    })\n  ]\n};","lang":"javascript","description":"This quickstart demonstrates configuring `rollup-plugin-server` to serve a basic Rollup bundle from a 'dist' directory, automatically opening the browser to `http://localhost:10001`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}