Registry / serialization / lodash-compat

lodash-compat

JSON →
library3.10.2jsnpmunverified

lodash-compat is the discontinued compatibility build of Lodash v3.10.2, offering modular utility functions specifically for Node.js environments. This package provided a way to load the entire Lodash v3 library, specific method categories like `array`, or individual functions such as `chunk` via CommonJS `require` statements. Explicitly marked as discontinued with no further development, it is considered abandoned. Its primary role was to bridge older environments with a modular version of Lodash v3, but it lacks features, performance enhancements, and security updates present in modern Lodash (v4 and beyond), making it unsuitable for contemporary development and a strong candidate for migration.

npm install lodash-compat
INSTALL
IMPORT
SIG · LODASH-COMPAT
L
lodash-compat
serializationjavascriptv3.10.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

_
const _ = require('lodash-compat');
import _ from 'lodash-compat';
This package is CommonJS-only and does not support ES modules. This imports the full Lodash v3 compatibility build.
array
const array = require('lodash-compat/array');
import { array } from 'lodash-compat';
Imports the 'array' method category from the Lodash v3 compatibility build, providing functions like `chunk`, `compact`, etc. CommonJS only.
chunk
const chunk = require('lodash-compat/array/chunk');
import { chunk } from 'lodash-compat/array';
Directly imports the 'chunk' function from the 'array' category. This granular import was a feature of the v3 compatibility build for CJS.

Demonstrates loading the full `lodash-compat` build, a method category, and an individual method, then using them.

const _ = require('lodash-compat'); const array = require('lodash-compat/array'); const chunk = require('lodash-compat/array/chunk'); console.log('Full build first item:', _.first([1, 2, 3])); console.log('Array category chunk:', array.chunk([1, 2, 3, 4], 2)); console.log('Individual chunk function:', chunk([5, 6, 7, 8], 3)); // Example using another method from the full build const users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user': 'fred', 'age': 40, 'active': false } ]; const activeUsers = _.filter(users, { 'active': true }); console.log('Filtered active users:', activeUsers);
Debug
Known issues
breakingThe `lodash-compat` package has been officially discontinued and is no longer maintained. No further development or security updates are expected. Users should migrate to a modern version of Lodash (v4+) or an alternative utility library.
fix
Migrate to `lodash` v4+ (`npm install lodash`) and update import statements (`import { method } from 'lodash';`). Be aware of potential API changes between v3 and v4.
affects: >=3.10.2
breakingThis package is based on Lodash v3, which is an extremely old version. It lacks numerous features, performance improvements, and security patches present in contemporary JavaScript environments and modern Lodash versions.
fix
Upgrade to `lodash` v4+ to benefit from modern APIs, performance optimizations, and security updates. This may require reviewing your codebase for compatibility.
affects: >=3.10.2
gotcha`lodash-compat` exclusively uses CommonJS `require()` syntax. It does not provide ES Module (ESM) exports, making it incompatible with modern JavaScript modules without a transpilation step or specific bundler configurations.
fix
For new projects or migration, use `lodash` v4+, which offers both CommonJS and ES Module exports. If stuck on `lodash-compat`, ensure your build system handles CommonJS modules (e.g., Webpack, Rollup, Parcel) when targeting browser environments.
affects: >=3.10.2
Errors
Common errors & fixes
TypeError: _.methodName is not a function
Attempting to use a Lodash function that was either not present in v3, or trying to access a method from the full build when only a category or individual method was imported.
fix
Verify the function exists in Lodash v3's API, and ensure you are importing the full `lodash-compat` build if using global `_` access, or the correct category/individual method path.
Cannot find module 'lodash-compat/path/to/method'
Incorrect import path for a specific method or category, or attempting to import a method that doesn't exist at the specified path in `lodash-compat`.
fix
Refer to the `lodash-compat` GitHub repository (specifically the `3.10.2-npm` branch) to verify the correct modular import paths. Note that paths differ significantly from modern Lodash.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES module `import` syntax with `lodash-compat`, which only supports CommonJS `require()`.
fix
Replace `import` statements with `const _ = require('lodash-compat');` or migrate to `lodash` v4+ for proper ESM support. Ensure your `package.json` `type` field and file extensions are correctly configured for your module system.
Upgrade
Version history
3.10.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
lodash-compat — npm install lodash-compat · libregistry