egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
8.48k stars 209 forks source link

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

Open rickymohk opened 6 months ago

rickymohk commented 6 months ago

Let say I have "stripInternal": true in tsconfig.json and these 3 files in src/

// foo.ts
/** @internal */
export class Foo{
    x:number = 1
}
// bar.ts
import { Foo } from "./foo";

export class Bar{
    foo: Foo = new Foo();
}
// 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.