trailpack-autoreload
v1.0.2
Published
[![NPM version][npm-image]][npm-url] [![Build status][ci-image]][ci-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Code Climate][codeclimate-image]][codeclimate-url]
Downloads
16
Readme
trailpack-autoreload
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).