Skip to content
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

error transfrom from ESM export default to CJS module.exports #992

Open
LoTwT opened this issue Sep 8, 2023 · 4 comments
Open

error transfrom from ESM export default to CJS module.exports #992

LoTwT opened this issue Sep 8, 2023 · 4 comments

Comments

@LoTwT
Copy link

LoTwT commented Sep 8, 2023

issue

It will only transform export default to module.exports when

  • the entry file has only export default without any named export
  • with splitting: true and cjsInterop: true in the tsup.config.ts.

In other cases, it doesn't work.

reproduction

https://github.com/LoTwT/tsup-cjs-default-export-issue

  • pnpm i
  • pnpm build
  • node test.cjs

The result is false.

  • remove the export const fn in the index.ts
  • pnpm build
  • node test.cjs

The result is true.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@sxzz
Copy link
Collaborator

sxzz commented Sep 8, 2023

Wait evanw/esbuild#3281

@segevfiner
Copy link
Contributor

So, put in other words, cjsInterop is broken ATM without splitting: true.

@lvjiaxuan
Copy link

lvjiaxuan commented Dec 19, 2023

So, put in other words, cjsInterop is broken ATM without splitting: true.

I dont know why. Fow now (ts@8.0.1), the cjsInterop doesn't work anyway with splitting be neither true or false.

@xiaozhuai

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants