I have npm package which both can be imported in other projects and also be used as a CLI. To do this, I have 2 option configurations:
export default defineConfig(() => [
{
entry: {
lib: './src/index.ts',
},
},
{
entry: {
cli: './src/cli.ts',
},
},
]);
However, this warns about the TS2345 error. Basically, it is expecting both the entry
objects to have same keys. Since I added lib
in first one, it is expecting that I add it to the second one as well and same for cli
.
If I add a @ts-ignore
comment, tsup
works as expected and generates the desired outputs.
Also, creating the options object outside of the array fixes the issue:
const op1: Options = {
entry: {
lib: './src/index.ts',
},
}
const op2: Options = {
entry: {
cli: './src/cli.ts',
},
}
export default defineConfig(() => [
op1,
op2,
]);
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too