Stop emitting empty files
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 274
- PR merge metrics
- No merged PRs in 30d
Description
Minimal reproduction -
File structure

tsup.config.ts
```ts
import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['lib', 'types'],
dts: true,
})
```
types/helpers.ts (only contains types)
```ts
export type Optional = T | null | undefined
```
lib/index.ts
```ts
import { Optional } from '../types/helpers'
export function log(message?: Optional) {
console.log(message ?? '')
}
```
This will output helpers.js with empty exports or full empty file if using esm format

Contributor guide
Research direction
Reproduce the issue with the shown tsup.config.ts, types/helpers.ts, and lib/index.ts, then inspect how the two entry points are processed and why a type-only entry produces helpers.js. Compare the generated ESM and other outputs; done means the type-only entry emits no empty JavaScript file while lib/index.ts still builds correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100