egoist / egoist/tsup

error transfrom from ESM `export default` to CJS `module.exports`

Open
#992 4 comments 15 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

## 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.