{"id":13773734,"url":"https://github.com/thgh/rollup-plugin-serve","last_synced_at":"2025-05-14T23:04:39.530Z","repository":{"id":11296908,"uuid":"69117094","full_name":"thgh/rollup-plugin-serve","owner":"thgh","description":"Serve your rolled up bundle like webpack-dev-server","archived":false,"fork":false,"pushed_at":"2025-02-06T20:46:12.000Z","size":298,"stargazers_count":248,"open_issues_count":31,"forks_count":54,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T12:21:13.899Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thgh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-24T17:28:28.000Z","updated_at":"2025-04-30T07:41:48.000Z","dependencies_parsed_at":"2024-01-13T11:13:40.784Z","dependency_job_id":"54bfe2e9-8e19-401d-bc95-c8d22e7d712c","html_url":"https://github.com/thgh/rollup-plugin-serve","commit_stats":{"total_commits":87,"total_committers":24,"mean_commits":3.625,"dds":0.4482758620689655,"last_synced_commit":"c21cb3ca589373065c6a44e0f348718d5b39bbca"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thgh%2Frollup-plugin-serve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thgh%2Frollup-plugin-serve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thgh%2Frollup-plugin-serve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thgh%2Frollup-plugin-serve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thgh","download_url":"https://codeload.github.com/thgh/rollup-plugin-serve/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253547215,"owners_count":21925545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:19.537Z","updated_at":"2025-05-14T23:04:34.463Z","avatar_url":"https://github.com/thgh.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["All-Purpose Awesome"],"readme":"# Rollup plugin to serve the bundle\n\n\u003ca href=\"LICENSE\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg\" alt=\"Software License\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/thgh/rollup-plugin-serve/issues\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues/thgh/rollup-plugin-serve.svg\" alt=\"Issues\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://standardjs.com/\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg\" alt=\"JavaScript Style Guide\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://npmjs.org/package/rollup-plugin-serve\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/rollup-plugin-serve.svg?style=flat-squar\" alt=\"NPM\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/thgh/rollup-plugin-serve/releases\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/release/thgh/rollup-plugin-serve.svg\" alt=\"Latest Version\" /\u003e\n\u003c/a\u003e\n\n## Installation\n\n```\nnpm install --save-dev rollup-plugin-serve\n\nyarn add rollup-plugin-serve\n```\n\n## Usage\n\n```js\n// rollup.config.js\nimport serve from 'rollup-plugin-serve'\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: ...\n  },\n  plugins: [\n    serve('dist')\n  ]\n}\n```\n\n### Options\n\nBy default it serves the current project folder. Change it by passing a string:\n\n```js\nserve('public')    // will be used as contentBase\n\n// Default options\nserve({\n  // Launch in browser (default: false)\n  open: true,\n\n  // Page to navigate to when opening the browser.\n  // Will not do anything if open=false.\n  // Remember to start with a slash.\n  openPage: '/different/page',\n\n  // Show server address in console (default: true)\n  verbose: false,\n\n  // Folder to serve files from\n  contentBase: '',\n\n  // Multiple folders to serve from\n  contentBase: ['dist', 'static'],\n\n  // Set to true to return index.html (200) instead of error page (404)\n  historyApiFallback: false,\n\n  // Path to fallback page\n  historyApiFallback: '/200.html',\n\n  // Options used in setting up server\n  host: 'localhost',\n  port: 10001,\n\n  // By default server will be served over HTTP (https: false). It can optionally be served over HTTPS\n  https: {\n    key: fs.readFileSync('/path/to/server.key'),\n    cert: fs.readFileSync('/path/to/server.crt'),\n    ca: fs.readFileSync('/path/to/ca.pem')\n  },\n\n  //set headers\n  headers: {\n    'Access-Control-Allow-Origin': '*',\n    foo: 'bar'\n  },\n\n  // set custom mime types, usage https://github.com/broofa/mime#mimedefinetypemap-force--false\n  mimeTypes: {\n    'application/javascript': ['js_commonjs-proxy']\n  }\n\n  // execute function after server has begun listening\n  onListening: function (server) {\n    const address = server.address()\n    const host = address.address === '::' ? 'localhost' : address.address\n    // by using a bound function, we can access options as `this`\n    const protocol = this.https ? 'https' : 'http'\n    console.log(`Server listening at ${protocol}://${host}:${address.port}/`)\n  }\n})\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nContributions and feedback are very welcome.\n\nThis project aims to stay lean and close to standards. New features should encourage to stick to standards. Options that match the behaviour of [webpack-dev-server](https://webpack.js.org/configuration/dev-server/#devserver) are always ok.\n\nTo get it running:\n\n1. Clone the project.\n2. `npm install`\n3. `npm run build`\n\n## Credits\n\n- [Thomas Ghysels](https://github.com/thgh)\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n[link-author]: https://github.com/thgh\n[link-contributors]: ../../contributors\n[rollup-plugin-serve]: https://www.npmjs.com/package/rollup-plugin-serve\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthgh%2Frollup-plugin-serve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthgh%2Frollup-plugin-serve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthgh%2Frollup-plugin-serve/lists"}