Skip to content

Conversation

@denisx
Copy link

@denisx denisx commented Oct 1, 2025

Add esm imports for compat version

Helpful for lodash migrations (like https://gist.github.com/denisx/a06fc2b518ec152d2ef631674ac87b30)

@vercel
Copy link

vercel bot commented Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
es-toolkit Ready Ready Preview Comment Oct 6, 2025 4:20pm

@denisx denisx marked this pull request as draft October 1, 2025 13:45
@denisx denisx marked this pull request as ready for review October 1, 2025 13:54
@denisx denisx changed the title feat: add default imports; feat: add esm compet imports; Oct 1, 2025
@denisx denisx changed the title feat: add esm compet imports; feat: add esm compat imports; Oct 1, 2025
@raon0211
Copy link
Collaborator

raon0211 commented Oct 3, 2025

Hey! Thanks for the PR. Quick question: since importing from es-toolkit/compat/func already tree-shakes and only pulls in what you need, do we really need ESM exports? What's the benefit we'd get from them? (Just asking because dual CJS/ESM packages can introduce risks like dual package hazards, so I want to make sure it's worth it.)

@denisx
Copy link
Author

denisx commented Oct 3, 2025

@raon0211 i see more clear build with esm imports. 'require' not well.
if you care about default require compability, we can make second build folder, such as compat-esm or any )

4 step to future from work experiments (ui build, d - desktop, m - mobile)

Screenshot+2025-10-01+at+23 12 20

a bit clear zip size (-1.5 kb) and more effective raw size (-8.5 kb) from 'require' compat

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.

3 participants