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.
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"
}
}
}
}
| "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.
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.
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.