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

fix: add dist package.json to files #619

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

antstanley
Copy link
Contributor

Node.js uses either file extensions or the "type" field in package.json to determine if files are CommonJS or ES Module files. When we shipped dual module support, package.json files were placed in both dist/esm and dist/cjs with the correct "type" property. This would enable consumers of the library to correctly interpret what type of module system the files were using.

The problem is that we did not add these dist specific sub package.json files to the files property of the root package.json so they were never published. This led to Node assuming all files were ESM, even the ones in dist/cjs.

This leads to errors for folks trying to use CommonJs. This PR adds those files into the files property to resolve this issue.

Resolves #615

@naorpeled naorpeled merged commit 37b4fc3 into jeremydaly:main Nov 1, 2023
5 checks passed
@naorpeled
Copy link
Collaborator

Thanks @antstanley !!!

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.

Version 0.9.x starting to give ESM related errors
2 participants