Skip to content

chore: Ship unminified file as ESM entrypoint #752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

zashraf1985
Copy link
Contributor

Background

This PR is copied from 484. It was contributed by @jasonkarns a couple of years ago. I just pulled his changes, merged master and resolved conflicts.

Summary

ESM entrypoints are very very likely to be consumed by bundlers, not loaded directly into browsers. Therefore it is preferable that the bundlers have access to the unminified source so that consumers can have more control over the final output.

This change adds an ESM output bundle that is not minified with terser. (#477 has merged which also adds the unminified ES bundle, so this PR now just makes the unminified bundle the module entrypoint.)
Notably, the unminified bundle is created in addition to the minified bundle;
so the minified bundle is still distributed with the package (at the same output location).

This way users who do actually want the minified bundle may still use it.

However, the package.json#module entrypoint is changed to reference the unminified bundle, as this is most likely what users will want when consuming from a bundler. (And bundlers are virtually the exclusive consumers of the module entrypoint.)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.185% when pulling 4f00c9e on zeeshan/change-module-entry into 5e8d539 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.185% when pulling 4f00c9e on zeeshan/change-module-entry into 5e8d539 on master.

Copy link
Contributor

@msohailhussain msohailhussain left a comment

Choose a reason for hiding this comment

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

lgtm

@zashraf1985 zashraf1985 merged commit e092f81 into master Apr 11, 2022
@zashraf1985 zashraf1985 deleted the zeeshan/change-module-entry branch April 11, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants