Skip to content

Conversation

@Andarist
Copy link

That's a common misconception but browser field should not be used for UMD bundles. It's an alias field that should contain alternative implementations browser-specific implementations.

To put more context around it - you want modern bundlers (such as webpack) to pick up contents of module field because it refers to file authored in ES modules and thus supporting tree-shaking etc. But by specifying a browser field you make it more important for a bundler like webpack and it picks it up instead of the module one. So many consumers of your library end up with unoptimized bundle & extra bytes if they use ur dependencies somewhere else too (because UMD bundle contains copy of them).

If you have any questions regarding this, please just ask - I'm happy to help and to clarify this more if needed :)

HannesGitH added a commit to HannesGitH/flubber2 that referenced this pull request Oct 1, 2022
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