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 ESM exports in package.json. Update microbundle. #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fedemp
Copy link

@fedemp fedemp commented Oct 11, 2023

Since this package is published as commonjs, es6 files are now published using the mjs extension.

Added more explicit file paths in the exports field, pointing to a unique declaration file for each bundle.

Declaration file is copied using the mts extension so it's explicitly marked as es6.

The package now passes the publint and Are the types wrong? tests.

Since this package is published as commonjs, es6 files are now published
using the mjs extension.

Added more explicit file paths in the `exports` field, pointing to a
unique declaration file for each bundle.

Declaration file is copied using the mts extension so it's explicitly
marked as es6.

The package now passes the [publint](https://publint.dev/) and [Are the
types wrong?](https://arethetypeswrong.github.io/) tests.
}
},
"sideEffects": false,
"scripts": {
"build": "microbundle",
"build": "microbundle && cp ./dist/index.d.ts ./dist/index.d.mts",
Copy link
Author

Choose a reason for hiding this comment

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

Are the types wrong? complains if we use the same index.d.ts file for both import and require cause it's detected a cjs file. 🎭 Masquerading as CJS

cp is not available in Windows, but since this is a development script that won't be run by consumers, I assume it would be fine.

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.

None yet

1 participant