We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
.d.cts
Node.js: * unbuild: v3.0.1
https://stackblitz.com/edit/vitejs-vite-t55rnaxz?file=package.json,tsconfig.json,build.config.ts,src%2Findex.ts,dist%2Findex.d.cts&terminal=dev
First run build, this will emit the cjs output.
build
cjs
The source index.ts only contains a default export:
index.ts
export default function add(): number { return 42 }
In the index.cjs output, there is only the default export (this is correct ✅):
index.cjs
module.exports = add;
But the index.d.cts output, it's:
index.d.cts
export { add as default };
this is wrong ❌, because this would lead to ❗️ Incorrect default export . You can run check to verify this problem.
check
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;
export { XXX as default };
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 🙌🏻)
No response
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Environment
Node.js: *
unbuild: v3.0.1
Reproduction
https://stackblitz.com/edit/vitejs-vite-t55rnaxz?file=package.json,tsconfig.json,build.config.ts,src%2Findex.ts,dist%2Findex.d.cts&terminal=dev
Describe the bug
First run
build
, this will emit thecjs
output.The source
index.ts
only contains a default export:In the
index.cjs
output, there is only the default export (this is correct ✅):But the
index.d.cts
output, it's:this is wrong ❌, because this would lead to ❗️ Incorrect default export . You can run
check
to verify this problem.And it should be:
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 };
toexport = 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
The text was updated successfully, but these errors were encountered: