trailpack-autoreload

1.0.2 • Public • Published

trailpack-autoreload

NPM version Build status Dependency Status Code Climate

This Trailpack will automatically reload your Trails application on code changes. It listens for changes in api/ and config/.

Install

$ npm install --save trailpack-autoreload

Configure

// config/main.js
module.exports = {
  packs: [
    // ... other trailpacks
    require('trailpack-autoreload')
  ]
}

This trailpack offers significant performance advantages over other solutions such as nodemon, which restarts the entire node process. This trailpack detects the file(s) in which the change occured, evicts those modules from the require cache, and reloads the Trails application (via app.start()). Moreover, the application will continue running in its current state if a syntax error is written into a watched file; Trails will inform you of the error, and carry on.

The synchronous node require statement incurs non-negligible boot-time overhead. We avoid these costs by evicting only the affected module(s).

Package Sidebar

Install

npm i trailpack-autoreload

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • trails