-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Environment
Node.js: *
unbuild: v3.0.1
Reproduction
Describe the bug
First run build, this will emit the cjs output.
The source index.ts only contains a default export:
export default function add(): number {
return 42
}In the index.cjs output, there is only the default export (this is correct ✅):
module.exports = add;But the index.d.cts output, it's:
export { add as default };this is wrong ❌, because this would lead to ❗️ Incorrect default export . You can run check to verify this problem.
And it should be:
export = add;Another build tool tsup could have encountered the same problem, but they introduced a fix for this:
https://github.com/egoist/tsup/blob/cd03e1e00ec2bd6676ae1837cbc7e618ab6a2362/src/rollup.ts#L92-L109
They manually replaced this from export { XXX as default }; to export = XXX;
I'm wondering if we could do the same for unbuild ❤️.
(If that's the solution, I can popup a PR for it 🙌🏻)
Additional context
No response
Logs
No response