`stripInternal: true` causes RollupError "module" is not exported in DTS build
- 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
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