serve-dev

1.0.0-alpha.6 • Public • Published

serve-dev

🏗️ A very simple but highly customizable server for local web development

  • 👀 Watch source files
  • 🔁 Live reload when changes occur
  • 🏃‍♂️ Quick to set up
  • 💪 Unopinionated about how source files get compiled

Setup

yarn add --dev serve-dev
// server.mjs
// node server.mjs (Node v13+)
 
import DevServer from 'serve-dev';
 
new DevServer({
  root: 'public',
  port: 9000,
  watch: {
    paths: ['src'],
    onChange(filePath) {
      console.log(`${filePath} changed.`);
      return {shouldReloadPage: true};
    }
  },
}).start()

Check out example/server.mjs for a more advanced example.

Contribute

Make your changes and run yarn example to test them using the example setup.

Readme

Keywords

none

Package Sidebar

Install

npm i serve-dev

Weekly Downloads

2

Version

1.0.0-alpha.6

License

MIT

Unpacked Size

6.71 kB

Total Files

8

Last publish

Collaborators

  • kvendrik