Get the latest tech news

Implementing native Node.js hot modules (technical write up)


# HMR natively in Node.js (technical write up) One of the key factors in rapid development is discarding as little state as possible. In Node.js, this means the new --watch flags are not that useful, since they throw everything away.

To handle this need, we have a FileTree class, which does nothing other than load a file tree into memory, and optionally keep it up to date via.watch(), which returns an EventEmitter with a filesUpdated event. Node's native file watcher is now disk efficient, and returns all the information we need, so we don't need chokidar for this. As a consequence of having a dependency tree, we can easily send a moduleInvalidated event at the same time that we update its version.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of native Node.js

native Node.js

Photo of hot modules

hot modules