rollup-plugin-dev is a Rollup plugin that provides a robust development server for local development workflows. The current stable version is 2.1.0, and it follows a feature-driven release cadence. It's built on Fastify, offering a modern, performant, and extensible server solution, distinguishing it from plugins using less active ecosystems like Koa (which it replaced in v2). Key features include detailed request logging, comprehensive proxying capabilities (with path rewriting), support for URL base paths, and automatic server shutdown when Rollup is not in watch mode. It supports single-page application (SPA) fallback routing and provides extensive configuration options for fine-tuning server behavior and integrating custom Fastify plugins.
npm install rollup-plugin-devVerified import paths — ran on the pinned version, not inferred.
This quickstart configures `rollup-plugin-dev` to serve static files from `public` and `dist` directories, listen on port 3000, enable SPA routing, and proxy API requests.
Review your `server` and `extend` options, migrating any Koa-specific logic to Fastify's plugin system or server configuration attributes. Refer to Fastify's documentation.
Update your `proxy` configuration to an array of objects, using `from` and `to` properties. For path rewrites, ensure `opts` are configured correctly for `fastify-http-proxy`. Example: `proxy: [{ from: '/api', to: 'http://localhost:9000/resources' }]`.Use the `extend` option with caution. Always thoroughly test custom Fastify plugins and refer to Fastify's official documentation for best practices. It is recommended to wrap custom plugins with `fastify-plugin`.
If you need the server to run even outside of Rollup's watch mode (e.g., for a one-off build preview), set the `force: true` option in your plugin configuration.
Update the `proxy` option from an object to an array of `{ from: '...', to: '...' }` objects. Example: `proxy: [{ from: '/api', to: 'http://localhost:3000' }]`.Specify a different `port` option in your plugin configuration, e.g., `dev({ port: 3001 })`. The plugin will attempt to find the next available port if the specified one is busy, but explicitly setting it can prevent confusion.Ensure that the fallback HTML file is located within one of the `dirs` being served. If `spa` is set to a specific path, e.g., `spa: 'path/to/fallback.html'`, verify that `path/to/fallback.html` is relative to one of your `dirs` entries.
Either run Rollup with the watch flag (`rollup -c --watch`) or explicitly set `force: true` in your `rollup-plugin-dev` configuration if you intend the server to run for a non-watch build.
No dependency data recorded yet.