Skip to content

Conversation

@erengeez
Copy link

I noticed that using this library will bundle the entire lodash library even if there are no other lodash dependencies in the app project code. It happens when the app project has lodash as a dev dependency somewhere in the dependency tree. Lodash gets installed in the node_modules and then the bundler resolve imports in this library as imports from node_modules/lodash and not from the small modular packages.

The fix is pretty straightforward - just explicitly import from the modular lodash packages. I checked my bundle with webpack-bundle-analyzer after the fix and there were no lodash present as expected.

@erengeez erengeez changed the title Explicitly import lodash functions from modular packages to avoid potentially bundling the whole lodash fix: explicitly import lodash functions from modular packages to avoid potentially bundling the whole lodash Sep 28, 2025
@erengeez erengeez force-pushed the fix-lodash-modular-imports branch from a6de1ec to 81f78da Compare October 10, 2025 07:01
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.

1 participant