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: export both cjs and esm types #212

Closed

Conversation

RebeccaStevens
Copy link
Contributor

@RebeccaStevens RebeccaStevens commented May 29, 2022

output: [{ file: pkg.types, format: "es" }],
output: [
{ file: pkg.exports.types.import, format: "es" },
{ file: pkg.exports.types.require, format: "commonjs", exports: "named" },
Copy link
Owner

Choose a reason for hiding this comment

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

this won’t really have any effect, as we override these output options; and exclusively only generate ES exports.

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 need to generate both a .d.mts and a .d.cts file. These two files would be identical but they need to be different files.

I'll leave it to you to figure what the best way to do that is. Whether it be to use this PR as is, use format: "es" for both outputs or just generate one then copy-paste it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could even just shorten it to:

output: [{ file: pkg.exports.types.import }, { file: pkg.exports.types.require }]

Copy link
Owner

Choose a reason for hiding this comment

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

I think the rollup typings require you to define at least one format. I can take a look on the weekend again, I was distracted with other matters these days.

@Finesse
Copy link

Finesse commented Jul 6, 2023

I experience this problem too. Do you need help with the PR?

@Swatinem
Copy link
Owner

#271 did just this slightly differently

@Swatinem Swatinem closed this Jul 31, 2023
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.

"type": "module" is preventing this package from being import from non-module environments
3 participants