lazy-req alternatives and similar modules
Based on the "Miscellaneous" category.
Alternatively, view lazy-req alternatives based on common mentions on social networks and blogs.
-
Electron
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS -
cheerio
The fast, flexible, and elegant library for parsing and manipulating HTML and XML. -
jsdom
A JavaScript implementation of various web standards, for use with Node.js -
v86
x86 virtualization in your browser, recompiling x86 to wasm on the fly -
ssh2
SSH2 client and server modules written in pure JavaScript for node.js -
hypernova
A service for server-side rendering your JavaScript views -
webworker-threads
Lightweight Web Worker API implementation with native threads -
node-pre-gyp
Node.js tool for easy binary deployment of C++ addons -
mem
Memoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input -
dot-prop
Get, set, or delete a property from a nested object using a dot path -
basic-ftp
FTP client for Node.js, supports FTPS over TLS, passive mode over IPv6, async/await, and Typescript. -
schemapack
Create a schema object to encode/decode your JSON in to a compact byte buffer with no overhead. -
nar
node.js application archive - create self-contained binary like executable applications that are ready to ship and run -
stringify-object
Stringify an object/array like JSON.stringify just without all the double-quotes -
cashify
💸 Lightweight currency conversion library, successor of money.js -
node-video-lib
Node.js Video Library / MP4 & FLV parser / MP4 builder / HLS muxer -
resolve-from
Resolve the path of a module like require.resolve() but from a given path -
remote-git-tags
Get tags from a remote git repo. Using only JS. No git binary required.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of lazy-req or a related project?
README
import-lazy 
Import a module lazily
Install
$ npm install import-lazy
Usage
// Pass in `require` or a custom import function
const importLazy = require('import-lazy')(require);
const _ = importLazy('lodash');
// Instead of referring to its exported properties directly…
_.isNumber(2);
// …it's cached on consecutive calls
_.isNumber('unicorn');
// Works out of the box for functions and regular properties
const stuff = importLazy('./math-lib');
console.log(stuff.sum(1, 2)); // => 3
console.log(stuff.PHI); // => 1.618033
Note
Destructuring will cause it to fetch eagerly
While you may be tempted to do leverage destructuring, like this:
const {isNumber, isString} = importLazy('lodash');
Note that this will cause immediate property access, negating the lazy loading, and is equivalent to:
import {isNumber, isString} from 'lodash';
Usage with bundlers
If you're using a bundler, like Webpack, you'll have to import your modules like this in order to have them properly bundled:
const importLazy = require('import-lazy');
const _ = importLazy(() => require('lodash'))();
Related
- resolve-from - Resolve the path of a module from a given path
- import-from - Import a module from a given path
- resolve-pkg - Resolve the path of a package regardless of it having an entry point
- lazy-value - Create a lazily evaluated value
- define-lazy-prop - Define a lazily evaluated property on an object
Get professional support for this package with a Tidelift subscription Tidelift helps make open source sustainable for maintainers while giving companiesassurances about security, maintenance, and licensing for their dependencies.