IMPORT-RELOAD
Module reloading for Node.js
import-reload
is a NPM module that lets you live-relaod modules when they are modified without requiring server restart.
INSTALL
$ npm install import-reload
USAGE
Example
// foo.ts;
// main.ts; ; console.logfoo.bar; // outputs 1
Then modify foo.ts:
// foo.ts;
Back in main:
console.logfoo.bar; // outputs 2
API
reloadimportFn:Promise<U>, extractFn:T: Promise<T>;
importFn
should use the dynamic import function, e.g. () => import("./module)
.
extractFn
takes in the module returned by the import and returns the object to be used by the program.