toss

97% Smaller, 2x Faster: How es-toolkit Reached 10 Million Weekly Downloads (opens in new tab)

es-toolkit is a modern, TypeScript-first JavaScript utility library designed as a faster and smaller alternative to lodash. Built around ES Modules and independent functions, it can reduce bundle sizes by up to 97% and improve runtime performance by more than 2x. Its es-toolkit/compat package provides a 100% lodash-compatible migration path with little or no code changes.

Why es-toolkit was created

  • Toss’s frontend team saw an opportunity to modernize the utility-library ecosystem.
  • lodash was designed before ES Modules, advanced JavaScript engines, TypeScript, and bundle size became central concerns.
  • es-toolkit was built from scratch with:
    • Native ES Module support
    • Tree-shaking-friendly independent functions
    • Built-in TypeScript definitions
    • Modern runtime optimizations

Bundle size and runtime performance

  • lodash-es can include internal helper dependencies even when importing a single function.
  • es-toolkit functions are designed to be independent, avoiding hidden dependencies.
  • A sample set of five functions—groupBy, keyBy, pick, omit, and debounce—adds roughly:
    • 30 KB with lodash-es
    • 1 KB with es-toolkit
  • The library reports up to 97% smaller bundles and more than 2x faster execution.
  • Specific benchmarks include:
    • sample: approximately 2,000 bytes in lodash versus 88 bytes in es-toolkit
    • omit: approximately 11.8x faster at runtime

Adoption and ecosystem support

  • es-toolkit surpassed 10 million weekly npm downloads within 18 months.
  • It has been adopted by Microsoft, Yarn, Storybook, IBM, Recharts, Ink, and Dify.
  • The article emphasizes that adoption came through independent evaluations and benchmarks rather than major promotional campaigns.

Migration from lodash

  • Most imports can be changed directly:

    import { pick } from 'es-toolkit';
    
  • es-toolkit/compat provides a drop-in lodash replacement with full compatibility, validated against lodash’s test suite.

  • Existing projects can redirect the lodash dependency without changing source code:

    {
      "dependencies": {
        "lodash": "npm:es-toolkit@^1.44.0"
      }
    }
    
  • Teams can later migrate from compatibility imports to native es-toolkit imports for additional bundle and performance benefits.

  • An official @es-toolkit/codemod tool is available to automate migration.

TypeScript and maintenance

  • Type definitions are shipped alongside the implementation and are kept synchronized.
  • This avoids the version mismatches and inaccuracies possible with lodash’s separately maintained @types/lodash package.
  • The project is actively maintained, with regular additions and responsive issue and pull-request handling.

Project direction

  • es-toolkit is part of Toss’s broader open-source initiative.
  • Related projects include:
    • overlay-kit for Promise-based React overlays
    • use-funnel for type-safe multi-step flows
    • suspensive for React Suspense primitives
  • The library is MIT licensed and installable with npm install es-toolkit.

For most lodash users, the recommended approach is to start with the compatibility alias for an immediate, low-risk upgrade, then progressively adopt native es-toolkit imports to maximize bundle-size and performance improvements.