export-lazy-prop
![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)
Export a lazily evaluated property.
Installation
npm install export-lazy-prop
Usages
exports.foo = require("./foo");
exports.bar = require("./bar");
const util = require("./util");
util.foo();
In this case, even if bar.js
is not used, it will still be loaded from the file system.
With export-lazy-prop
, modules will be loaded on demand.
const exportLazyProp = require("export-lazy-prop");
exportLazyProp(exports, "foo", () => require("./foo"));
exportLazyProp(exports, "bar", () => require("./bar"));
const util = require("./util");
util.foo();
Or
const exportLazyProp = require("export-lazy-prop");
exportLazyProp(exports, {
foo: () => require("./foo"),
bar: () => require("./bar"),
});
Related
License
Copyright (c) 2019 dailyrandomphoto. Licensed under the MIT license.