-
Notifications
You must be signed in to change notification settings - Fork 10
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 dual emit declaration files #9
Fix dual emit declaration files #9
Conversation
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
"require": "./dist/index.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We’re letting extension substitution do the work here, but if you want to be explicit about specifying types, this has the same outcome:
{
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
@@ -18,15 +17,17 @@ | |||
"dev": "vitest", | |||
"build": "tsup src/index.ts --format cjs,esm --dts", | |||
"lint": "tsc", | |||
"release": "turbo build lint test && changeset publish" | |||
"attw": "attw --pack", | |||
"release": "turbo build lint test attw && changeset publish" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to add attw to turbo.json to get this working I think.
What outputs does attw --pack have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an exit code (and stdout whether it succeeds or fails, but only interesting in CI if you need to look at why it failed). It runs npm pack
but deletes the file after checking it.
Wow, pal - thanks so much for making this change on this repo. Small changes needed to turbo.json, outlined in comment. |
Sure thing! I discovered recently that you were a tsup user, so I figured something like this would be a good way to prove out the tsup change I made on something real, and be able to link to it as an example of how to take advantage of the new output, since a small package.json change is necessary. |
Looks great, thanks pal! |
tsup just published egoist/tsup#934, which fixes a module format agreement issue that you inherited from its output. Details in the tsup PR, but:
Before
After
I’ve also taken the liberty of including this check as part of your release process, since unlike tsc, tsup does not actually check that the output is actually valid in all these scenarios.