1.0.0 • Published 4 years ago

rollup-dev v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Rollup Dev Server

Serves your app and reloads when files change

Features

  • 🚀 Easy setup
  • 🔍 Built-in error overlay

Getting started

Installation

yarn add rollup-dev

or

npm i rollup-dev

Setting up your app

For now there's no way to automatically inject client script (like webpack-dev-server does) so you need to include it yourself. This should be done in a place closest to the entry point.

import { setupClient } from "rollup-dev/dist/client";

if (process.env.NODE_ENV !== "production") {
  setupClient();
}

Note: you should import directly from rollup-dev/dist/client to prevent bundling the server

Running the server

Once client is included in the application, you can run the server which will watch for changes and reload the client when needed. The easiest way is to use the CLI utility.

cd /path/to/app
rollup-dev ./dist

Note: ./dist points to the static files, change it if your build destination is different

The CLI also takes some useful options:

  • --port - Choose a different port to run on
  • --config - Set path to rollup.config.js file

Note: If your config file is not rollup.config.js, you must change --config option

License

MIT