Multiple empty lines in generated CJS file before the export statement, while exports are collapsed to one line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 274
- PR merge metrics
- No merged PRs in 30d
Description
I discovered there is empty lines before the exports statements in the generated CJS file. All the exports statement will be placed in one line.
Here are some examples:
2 exports, 3 empty line after previous non-empty.

3 exports, 4 empty line after previous non-empty.

7 exports, 8 empty line after previous non-empty.

I am using the config like this:
```ts
import type { Options } from 'tsup';
const tsup_config: Options = {
splitting: true,
clean: true,
dts: true,
format: ["esm", "cjs"],
bundle: false,
skipNodeModulesBundle: true,
target: 'esnext',
outDir: 'dist',
entry: ['src/**/*.ts']
};
export default tsup_config
```
Can I ask is this behaviour a bug, or designed to be like this, or if there is a failure in my configuration ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the TypeScript tsup configuration shown, especially CJS output with multiple exports and bundle disabled. Inspect the generated CJS output and the relevant build path; done means exports are not preceded by an export-count-dependent run of empty lines while preserving valid CJS output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100