Skip to content

fix: get default export working in both ESM/CJS#799

Merged
kanadgupta merged 10 commits intomainfrom
fix/tsup-main-export-for-real
Sep 25, 2023
Merged

fix: get default export working in both ESM/CJS#799
kanadgupta merged 10 commits intomainfrom
fix/tsup-main-export-for-real

Conversation

@kanadgupta
Copy link
Copy Markdown
Contributor

@kanadgupta kanadgupta commented Sep 22, 2023

🧰 Changes

We use this library called tsup to bundle this library and according to Are The Types Wrong, CJS doesn't like when we have export default and non-default exports in the same file — this might be an issue with tsup or it might be an issue with CJS/ESM dual exported packages more broadly, not sure.

This PR removes the non-default exports from our main entrypoint file (i.e., src/index.ts), as well as consolidates the exports in our utils file. There are other improvements to be made but these ones seemed like the most straightforward.

I broke this out from the change in #798 since it feels like a breaking change. EDIT: after sleeping on it, I've decided this is technically a patch since it's fixing an issue with our existing v21 release.

🧬 QA & Testing

Do tests still pass?

Here's the before and after, using the Are The Types Wrong CLI (note the node16 (from CJS) column for the oas and oas/utils lines):

In main:

CleanShot 2023-09-25 at 10 32 17@2x

This PR:

CleanShot 2023-09-25 at 10 32 43@2x

@kanadgupta kanadgupta added the bug Something isn't working label Sep 22, 2023
Base automatically changed from fix/tsup-main-export to main September 22, 2023 19:59
@kanadgupta kanadgupta mentioned this pull request Sep 23, 2023
7 tasks
@kanadgupta kanadgupta marked this pull request as ready for review September 25, 2023 15:46
@kanadgupta kanadgupta merged commit 25a04c4 into main Sep 25, 2023
@kanadgupta kanadgupta deleted the fix/tsup-main-export-for-real branch September 25, 2023 15:51
kanadgupta added a commit that referenced this pull request Sep 25, 2023
@kanadgupta kanadgupta mentioned this pull request Sep 25, 2023
kanadgupta added a commit that referenced this pull request Sep 25, 2023
kanadgupta added a commit that referenced this pull request Sep 25, 2023
kanadgupta added a commit that referenced this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant