lazy-cache

JSON →
library 2.0.2 ·javascript maintenance
verified Jun 7, 2026

lazy-cache v2.0.2 is a tiny utility that defers requiring npm modules until they are actually accessed. It uses JavaScript getters to lazily load dependencies, which can reduce startup time and avoid executing problematic code from dependencies (e.g., libraries that modify globals or run side effects on require). The package is stable but effectively in maintenance mode (last release 2018). Key differentiators: no magic, native getters; works with CommonJS; has a separate webpack loader for bundler compatibility. However, it is largely superseded by ESM dynamic imports and tree-shaking.