1.0.0-alpha.6 ā€¢ Published 4 years ago

serve-dev v1.0.0-alpha.6

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

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.