package
Require extension that allows for caching/precompiling
npm install require-precompiledGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Require extension that allows for caching/precompiling
$ npm install --save require-precompiledconst installPrecompiler = require('require-precompiled');
const cache = require('my-cache-implementation');
installPrecompiler(filename => {
if (cache.hasEntryFor(filename)) {
return cache.getPrecompiledCode(filename);
}
// fall through to underlying extension chain;
return null;
});
// Any module required from this point on will be checked against the cache.
const foo = require('some-module');Type: Function(string: filename)
Return string contents for a cache hit, or null for a miss.
MIT © James Talmage