unjs / unbuild

📦 An unified javascript build system
MIT License
2.19k stars 84 forks source link

commonjs plugin should not include .ts extension #396

Open juetan opened 1 month ago

juetan commented 1 month ago

Environment

node 20

Reproduction

no

Describe the bug

in /src/builder/rollup.ts file, commonjs should not include .ts extension, is that expected? image

Additional context

No response

Logs

No response

pi0 commented 1 month ago

no (reproduction please)

juetan commented 1 month ago

no (reproduction please)

https://stackblitz.com/edit/vitejs-vite-z6f6jw?file=build.config.ts

when declaration: true, it build fail. then add rollup.commonjs.extensions,it works.

pi0 commented 1 month ago

Thanks for the reproduction. It seems the issue is with dts build step (since we bundle, usually importing ts in cjs context should be also doable)