Skip to content
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

feat: support esm #38

Merged
merged 2 commits into from
Sep 15, 2022
Merged

Conversation

mattcosta7
Copy link
Contributor

Build an esm version of headers-polyfill and expose via exports

Using tsup, similar to other msw tools to output an esm version of this library, and updating the exports field to support that output (as well as a module field and a secondary esm pacakge.json for completeness)

@mattcosta7 mattcosta7 changed the title Expose headers as esm Expose headers-polyfill as esm Sep 14, 2022
@mattcosta7 mattcosta7 marked this pull request as ready for review September 14, 2022 15:07
"types": "./lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we might eventually add a browser export as well here, that just re-exports from globalThis instead of always using the polyfill, since browsers should all support Headers now, but that's outside the scope of this work

Copy link
Member

Choose a reason for hiding this comment

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

@mattcosta7, this may be a good idea indeed for the future improvements.

Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you, @mattcosta7! 🎉

@kettanaito kettanaito changed the title Expose headers-polyfill as esm feat: support esm Sep 15, 2022
@kettanaito kettanaito merged commit 83126f6 into mswjs:main Sep 15, 2022
@kettanaito
Copy link
Member

Released: v3.1.0 🎉

This has been released in v3.1.0!

Make sure to always update to the latest version (npm i headers-polyfill@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

@kettanaito
Copy link
Member

There are a couple of regressions coming out from this (see mswjs/interceptors#285). I'm on fixing those.

@mattcosta7
Copy link
Contributor Author

There are a couple of regressions coming out from this (see mswjs/interceptors#285). I'm on fixing those.

Ah sorry, I should have labeled this a breaking to avoid semver issues!

@kettanaito
Copy link
Member

No worries. I've patched things everywhere, it should work properly now.

kettanaito added a commit to open-draft/deferred-promise that referenced this pull request Sep 7, 2023
- Inspired by mswjs/headers-polyfill#38
- Solves failing browser ESM compatibility introduced by
https://github.com/mswjs/interceptors/releases/tag/v0.24.1
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