# rollup-plugin-live-server

> serve rollup chagnes using live-server

Latest version **2.0.0** (published 2020-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-live-server
pnpm add rollup-plugin-live-server
yarn add rollup-plugin-live-server
bun add rollup-plugin-live-server
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-07-28 |
| First published | 2018-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rob@hixfamily.org |
| Maintainers | robhicks |
| Keywords | rollup, plugin, live-server, webpack-dev-server |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-live-server
- npm.io page: https://npm.io/package/rollup-plugin-live-server

## Dependencies (1)

- [live-server](https://npm.io/package/live-server.md) ^1.2.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2020-07-28
- 1.0.3 — 2019-04-14
- 1.0.2 — 2019-04-14
- 1.0.1 — 2018-12-04
- 1.0.0 — 2018-10-16

## README

rollup-plugin-live-server
=========================

# Why this thing

This will give you a webpack-developer-server experience using the wildly-popular, well-tested [live-server](https://www.npmjs.com/package/live-server).

# Why not rollup-plugin-serve

Because I don't like re-creating the wheel and it doesn't, or I couldn't get it to do, live updates.

# Use

This is a thin wrapper around live-server. You can use all of the options of live-server. If there is a problem with this plugin, it is most likely a problem with live-server.

```
npm i rollup-plugin-live-server -D
```

```Javascript
// rollup.config.js
import {liveServer} from 'rollup-plugin-live-server';
// or
const liveServer = require('rollup-plugin-live-server');

export default {
    input: client,
    plugins: [liveServer({
      port: 8001,
      host: "0.0.0.0",
      root: "demo",
      file: "index.html",
      mount: [['/dist', './dist'], ['/src', './src'], ['/node_modules', './node_modules']],
      open: false,
      wait: 500
    })],
    output: {
      file: 'dist/my-fabulous-thingy.js',
      format: 'es'
    }
}
```

# How it works
rollup-plugin-live-server serves the root directory and its subdirectories. It also watches the files for changes and when they happen, it sends a message through a web socket connection to the browser instructing it to reload. In order for the client side to support this, the server injects a small piece of JavaScript code to each requested html file. rollup-plugin-live-server establishes the web socket connection and listens to the reload requests.

# FAQ
- Q. Does it support HTTPS?
- A. Yes, see the live-server docs
- Q. Does it support XYZ?
- A. If live-server supports it then yes. And if live-server doesn't support it, go help live-server support it.

---
_Source: https://npm.io/package/rollup-plugin-live-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
