Skip to content

Mark the generated client as an ES Module #21

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 3 commits into from
Mar 13, 2024

Conversation

steveluscher
Copy link
Contributor

@steveluscher steveluscher commented Mar 12, 2024

Without this, you essentially can't import generated clients into a project that, itself, is an ESModule.

Copy link

changeset-bot bot commented Mar 12, 2024

🦋 Changeset detected

Latest commit: d358ee6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-solana-program Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lorisleiva
Copy link
Member

The tests are failing I'm afraid. It might be best to change the build script to export .mjs files for ESM instead.

@steveluscher
Copy link
Contributor Author

How about now?

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

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

Perfect, thank you!

@lorisleiva lorisleiva merged commit a25f252 into solana-program:main Mar 13, 2024
@github-actions github-actions bot mentioned this pull request Mar 13, 2024
@steveluscher steveluscher deleted the patch-1 branch March 13, 2024 18:17
lorisleiva added a commit that referenced this pull request Mar 14, 2024
Before adding the “module” package type in #21, `tsup` was generating CJS files as `.js` and ESM files as `.mjs`. After the PR, `tsup` started doing the opposite — i.e. CJS files as `.cjs` and ESM files as `.js` meaning our `package.json` was pointing to the wrong files.

This PR fixes this by updating the `package.json` accordingly but also defining the extension logic explicitly so we don’t get this sort of surprise in the future.
lorisleiva added a commit that referenced this pull request Mar 14, 2024
Before adding the “module” package type in #21, `tsup` was generating CJS files as `.js` and ESM files as `.mjs`. After the PR, `tsup` started doing the opposite — i.e. CJS files as `.cjs` and ESM files as `.js` meaning our `package.json` was pointing to the wrong files.

This PR fixes this by updating the `package.json` accordingly but also defining the extension logic explicitly so we don’t get this sort of surprise in the future.
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