{"id":13773660,"url":"https://github.com/pearofducks/rollup-plugin-dev","last_synced_at":"2025-08-20T16:31:45.489Z","repository":{"id":35796924,"uuid":"200536134","full_name":"pearofducks/rollup-plugin-dev","owner":"pearofducks","description":"development server for rollup with additional logging and options","archived":false,"fork":false,"pushed_at":"2022-05-18T07:19:25.000Z","size":615,"stargazers_count":59,"open_issues_count":2,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-30T10:32:32.739Z","etag":null,"topics":["developer-tools","koa","rollup"],"latest_commit_sha":null,"homepage":"","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/pearofducks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-04T20:01:48.000Z","updated_at":"2024-04-30T10:32:32.739Z","dependencies_parsed_at":"2022-08-23T18:20:25.846Z","dependency_job_id":null,"html_url":"https://github.com/pearofducks/rollup-plugin-dev","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Frollup-plugin-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Frollup-plugin-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Frollup-plugin-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Frollup-plugin-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pearofducks","download_url":"https://codeload.github.com/pearofducks/rollup-plugin-dev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230066721,"owners_count":18167544,"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":["developer-tools","koa","rollup"],"created_at":"2024-08-03T17:01:18.651Z","updated_at":"2024-12-19T13:07:38.532Z","avatar_url":"https://github.com/pearofducks.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["All-Purpose Awesome"],"readme":"# rollup-plugin-dev\n\na development server for rollup\n\n![a screenshot of this plugin running](/.github/assets/screenshot.png?raw=true)\n\n### why this plugin?\n\ncompared to other plugins, this plugin:\n- uses Fastify to provide the server and implement features\n  - while this means there are dependencies, it should also be trivial to add/modify to suit individual needs (see `extend` option below!)\n- has additional features that may be useful\n  - detailed logging of requests (see screenshot)\n  - full proxy support\n  - support for a basepath in the URL\n  - will automatically turn itself off when _watch_ mode isn't enabled\n\n## install\n\n```console\nnpm install --save-dev rollup-plugin-dev\n```\n\n```console\npnpm add --save-dev rollup-plugin-dev\n```\n\n## use\n\n```js\nimport dev from 'rollup-plugin-dev'\n\nexport default {\n  plugins: [\n    dev()\n  ]\n}\n```\n\n## options\n\n#### dirs\n\ndirectories to serve static files from\n\nexample: `dev('dist')`\u003cbr\u003e\nexample: `dev({ dirs: ['dist', 'lib'] })`\u003cbr\u003e\ndefault: `__dirname`\u003cbr\u003e\n\n_when no other options are needed, a shortcut is available to specify one folder_\n\n#### basePath\n\nprefix all served files with a base path - e.g. serve from `/static` instead of `/`\n\nexample: `dev({ basePath: '/static' })`\u003cbr\u003e\ndefault: `/`\n\n#### silent\n\nwill silence all log messages, as well as the warning printed when rollup is started outside of watch mode\n\nexample: `dev({ silent: true })`\u003cbr\u003e\ndefault: `false`\n\n#### proxy\n\nproxy a path to an upstream service\n\nexample: `dev({ proxy: [{ from: '/api', to: 'http://localhost:9000/resources' }] })`\u003cbr\u003e\nexample: `dev({ proxy: [{ from: '/api', to: 'http://localhost:9000/resources', opts: { preHandler: myPreHandler } }] })`\u003cbr\u003e\ndefault: `undefined`\u003cbr\u003e\n\n_`opts` can contain any valid options for [fastify-http-proxy](https://github.com/fastify/fastify-http-proxy)_\n\n#### spa\n\nserve a fallback page (for single-page apps)\n\nexample: `dev({ spa: true }) // will serve index.html`\u003cbr\u003e\nexample: `dev({ spa: 'path/to/fallback.html' })`\u003cbr\u003e\ndefault: `false`\n\n_if a path is provided, it should be relative to one of the `dirs` being served_\n\n_the fallback file must reside in one of the `dirs` being served_\n\n#### port\n\nthe port the server should listen on\n\nexample: `dev({ port: 3000 })`\u003cbr\u003e\ndefault: `8080`\n\n_the server will automatically listen on the first available port after 8080 if the specified/default port is taken_\n\n#### host\n\nthe host the server should listen on\n\nexample: `dev({ host: '0.0.0.0' })`\u003cbr\u003e\ndefault: `localhost`\n\n#### force\n\nforce the server to start, even if rollup isn't in watch mode\n\nexample: `dev({ force: true })`\u003cbr\u003e\ndefault: `false`\n\n#### dirname\n\nthe path to resolve any relative `dirs` from\n\nexample: `dev({ dirname: '/Users/MyUser/Development/my-project' })`\u003cbr\u003e\ndefault: `undefined`\n\n_this is generally not needed if one is running Rollup from package.json's `scripts`_\n\n#### server\n\nmodify options the Fastify server is booted with - accepts any valid [Fastify server attribute](https://www.fastify.io/docs/latest/Reference//Server)\n\nexample: `dev({ server: { connectionTimeout: 3000 } })`\u003cbr\u003e\ndefault: see `config.js` and the `serverDefaults` export\n\n_here be dragons - because modifying these options can wildly change server behavior, this is supported on an 'as is' basis only_\n\n#### extend\n\nenables full customization of the dev server, expects a [Fastify plugin](https://www.fastify.io/docs/latest/Reference/Plugins/)\n\nexample: `dev({ extend: fp(async (server) =\u003e server.register(myPlugin)) })`\u003cbr\u003e\ndefault: `undefined`\n\n#### onListen\n\nthis is a callback that runs after the server has started\n\nexample: `dev({ onListen(server) { server.log.info('Hello world') }`\ndefault: `undefined`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpearofducks%2Frollup-plugin-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpearofducks%2Frollup-plugin-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpearofducks%2Frollup-plugin-dev/lists"}