require-precompiled

2018-10-14 admin

require-precompiled是什么

什么是require-precompiled,Require extension that allows for caching/precompiling

require-precompiled使用教程帮助文档

require-precompiled Build Status Coverage Status

Require extension that allows for caching/precompiling

Install

$ npm install --save require-precompiled

Usage

const 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');

API

requirePrecompiled(callback)

callback

Type: Function(string: filename)

Return string contents for a cache hit, or null for a miss.

License

MIT © James Talmage

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-42635.html

文章标题:require-precompiled

回到顶部