Skip to content

refactor(deps): replace lodash with lodash-es - #288

Merged
lanesawyer merged 3 commits into
mainfrom
lane/migrate-to-lodash-es
Aug 21, 2026
Merged

refactor(deps): replace lodash with lodash-es#288
lanesawyer merged 3 commits into
mainfrom
lane/migrate-to-lodash-es

Conversation

@lanesawyer

@lanesawyer lanesawyer commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What

Replaces the CommonJS lodash dependency with the ESM-native lodash-es 4.18.1 across the three packages that already used it — core, scatterbrain, and site. No new packages gain a lodash dependency.

How

Manifests

  • lodashlodash-es 4.18.1 in packages/core, packages/scatterbrain, and site (site was on 4.17.23)
  • @types/lodash@types/lodash-es 4.17.12. lodash-es ships no declarations of its own, and it's weird that the version number doesn't match up with the latest, but it's all working!

Imports (15 files)

lodash-es doesn't resolve extensionless subpaths, so import reduce from 'lodash/reduce' becomes import { reduce } from 'lodash-es'. Tree-shaking is preserved since lodash-es is real ESM. Two incidental cleanups fell out of the rewrite:

  • scatterbrain/src/renderer.ts — merged two adjacent single-name imports into one
  • scatterbrain/src/shader.ts — replaced the namespace-import-plus-destructure (import * as lodash then const { keys, mapValues, reduce } = lodash) with a direct named import

Config

  • packages/core/tsconfig.jsontypes: ["@webgpu/types", "lodash"]"lodash-es"

PR Checklist

  • Is your PR title following our conventional commit naming recommendations?
  • Have you filled in the PR Description Template?
  • Is your branch up to date with the latest in main?
  • Do the CI checks pass successfully?
  • Have you smoke tested the example applications?
  • Did you check that the changes meet accessibility standards? (N/A — no UI changes)
  • Have you tested the application on these browsers?
    • Chrome (Fully supported)
    • Firefox (Major bug fixes supported)
    • Safari (Major bug fixes supported)

🤖 Generated with Claude Code

- Swap lodash 4.18.1 for lodash-es 4.18.1 in core, scatterbrain, and site
- Swap @types/lodash for @types/lodash-es (lodash-es ships no declarations)
- Convert lodash/<fn> subpath imports to named imports from 'lodash-es'
- Point the core tsconfig types entry at lodash-es
@lanesawyer
lanesawyer requested a review from a team as a code owner August 14, 2026 03:35
@lanesawyer
lanesawyer enabled auto-merge (squash) August 14, 2026 22:58
@lanesawyer lanesawyer mentioned this pull request Aug 14, 2026
10 tasks

@froyo-np froyo-np left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for doing this!

@lanesawyer
lanesawyer merged commit 231ee98 into main Aug 21, 2026
5 checks passed
@lanesawyer
lanesawyer deleted the lane/migrate-to-lodash-es branch August 21, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants