egoist / egoist/tsup

`stripInternal: true` causes RollupError "module" is not exported in DTS build

Open
#1,072 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Let say I have `"stripInternal": true` in `tsconfig.json` and these 3 files in `src/`
``` ts
// foo.ts
/** @internal */
export class Foo{
x:number = 1
}
```

``` ts
// bar.ts
import { Foo } from "./foo";

export class Bar{
foo: Foo = new Foo();
}
```

``` ts
// index.ts
export {Bar} from "./bar";
```

Then build
```
tsup src/index.ts --dts
```

I get
```
RollupError: "Foo" is not exported by "src/foo.ts", imported by "src/bar.ts".
```

Removing `/** @internal */` or unsetting `stripInternal` does build successfully, but I want to hide `Foo` from the `d.ts` file. I cannot repeat this issue using rollup alone so I open an issue here.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with src/foo.ts, src/bar.ts, and src/index.ts using `tsup src/index.ts --dts` and the shown tsconfig setting. Read the DTS build path and Rollup error handling around this reproduction. Done means the command builds successfully while Foo remains hidden from the generated d.ts output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rollup, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.