egoist / egoist/tsup

export default foo compiles as export { foo as default }

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

Description

I have code like:

`export default foo;`

but for some reason, tsup compiles this as:

```
export { foo as default }
```

I have confirmed that `tsc` does not compile this way, so it's something on tsup's side.

here's my tsup.config:

```
import { defineConfig } from 'tsup';

const commonOptions = {
entry: ['src/index.ts', 'src/debug.ts'],
splitting: false,
sourcemap: true,
clean: true,
minify: true,
};

export default defineConfig(() => [
{
...commonOptions,
format: 'esm',
// outExtension: () => ({ js: '.mjs' }),
dts: true,
clean: true,
},
]);
```

this is breaking auto-import of packages for me, so I'd rather just use the normal `export default` which fixes the problem.

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.