reprise

1.1.0 • Public • Published

reprise

npm Build Status dependencies Status devDependencies Status

Automatic hot-reloading for Babel-compiled Node.js processes

Usage

yarn reprise server.js

reprise will re-compile and re-import the given file when:

  • The given file changes
  • Any recursive dependency of the given file changes
  • package.json changes

reprise uses Babel, via babel-register, to compile on import. Project-specific Babel configuration (package.json, .babelrc, .babelrc.js) is respected, defaulting to @babel/env if none exists.

For usage with an existing Node.js CLI:

import { promisify } from 'util'
import * as path from 'path'
import reprise from 'reprise'
 
const sleep = promisify(setTimeout)
 
async function run() {
  const box = reprise(path.resolve('app.js'))
 
  while (true) {
    console.log(box.value)
    await sleep(1000)
  }
}
run()

The reprise function takes the path to an entry point within the current directory and returns a box whose value property contains the latest copy of the imported entry point.

Installation

Supported Versions of Node.js

reprise is only tested against the latest Current and LTS versions of Node.js.

Please ensure that your Node.js installation is up-to-date, and, if necessary, upgrade your installation.

npm Package

Install reprise by running

yarn add reprise

Or, if yarn is not installed, run

npm install --save reprise

Package Sidebar

Install

npm i reprise

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

353 kB

Total Files

24

Last publish

Collaborators

  • vinsonchuong