npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@prantlf/rollup-plugin-serve

v3.2.0

Published

Rollup plugin to serve the bundle and other files in the project directory.

Readme

@prantlf/rollup-plugin-serve

Rollup plugin to serve the bundle and other files in the project directory.

This is a fork of the original project with the following enhancements:

  • Additional webpack-dev-server features #106
    • compress
    • proxy
    • before
    • after
    • historyApiFallback (object format)
    • contentBasePublicPath
    • serveIndex
    • headers
    • autoPort

Installation

npm install --save-dev @prantlf/rollup-plugin-serve

Usage

// rollup.config.js
import serve from '@prantlf/rollup-plugin-serve'

export default {
  input: 'src/main.js',
  output: {
    file: 'dist/bundle.js',
    format: ...
  },
  plugins: [
    serve('dist')
  ]
}

Options

By default it serves the current project folder. Change it by passing a string:

serve('public')    // will be used as contentBase

// Default options
serve({
  // Launch in browser (default: false)
  open: true,

  // Page to navigate to when opening the browser.
  // Will not do anything if open=false.
  // Remember to start with a slash.
  openPage: '/different/page',

  // Show server address in console (default: true)
  verbose: false,

  // Folder to serve files from
  contentBase: '',

  // Multiple folders to serve from
  contentBase: ['dist', 'static'],

  // URL root path to serve the static content at
  contentBasePublicPath: '/',

  // Customize serving of static files, see https://expressjs.com/en/resources/middleware/serve-static.html
  staticOptions: {},

  // Set to true to enable the default compression, or to an object to customize the compression
  // according to https://expressjs.com/en/resources/middleware/compression.html
  compress: false,

  // Set to true to enable directory indexes, or to an object to customize the index generation
  // according to https://expressjs.com/en/resources/middleware/serve-index.html
  serveIndex: false,

  // Set to true to return index.html (200) instead of error page (404)
  historyApiFallback: false,

  // Path to fallback page, see also https://github.com/bripkens/connect-history-api-fallback
  historyApiFallback: '/200.html',

  // Options used in setting up server
  host: 'localhost',
  port: 10001,

  // Set to true to keep incrementing the value of port and trying to bind to it,
  // until a free port is found.
  autoPort: false,

  // By default server will be served over HTTP (https: false). It can optionally be served over HTTPS
  https: {
    key: fs.readFileSync('/path/to/server.key'),
    cert: fs.readFileSync('/path/to/server.crt'),
    ca: fs.readFileSync('/path/to/ca.pem')
  },

  // Set additional headers
  headers: {
    'Access-Control-Allow-Origin': '*',
    foo: 'bar'
  },

  // Set custom mime types, usage https://github.com/broofa/mime#mimedefinetypemap-force--false
  mimeTypes: {
    'application/javascript': ['js_commonjs-proxy']
  },

  // Let requests to /api/* be forwarded to http://localhost:3000/*
  // See the full documentation at https://webpack.js.org/configuration/dev-server/#devserverproxy
  proxy: [
    {
      context: ['/api'],
      target: 'http://localhost:3000',
      pathRewrite: { '^/api': '' },
    },
  ],

  // Customize the Express instance before all middlewares are installed
  before: function(app) {
    ...
  },

  // Customize the Express instance after all middlewares are installed
  after: function(app) {
    ...
  },

  // Execute function after server has begun listening
  onListening: function (server) {
    const address = server.address()
    const host = address.address === '::' ? 'localhost' : address.address
    // by using a bound function, we can access options as `this`
    const protocol = this.https ? 'https' : 'http'
    console.log(`Server listening at ${protocol}://${host}:${address.port}/`)
  }
})

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Contributions and feedback are very welcome.

This 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 are always ok.

To get it running:

  1. Clone the project.
  2. npm install
  3. npm run build

Credits

License

The MIT License (MIT). Please see License File for more information.