egoist / egoist/tsup

DTS files do not respect esBuildOptions

Open
#796 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

This is a followup on:

https://github.com/egoist/tsup/discussions/793

I have figured out how to generate the `mjs` files correctly, but tsup is not using the esbuild config to decide where to output the .d.ts files, so my consumers can't actually use my packages from typescript...

That config in the discussion:

```ts
import { defineConfig } from 'tsup'

export default defineConfig([
{
entry: [
"src/*.ts",
],
dts: true,
format: 'esm',
splitting: false,
sourcemap: true,
clean: true,
esbuildOptions(opts, ctx) {
opts.entryNames = "[dir]/[name]/index"
}
},
{
entry: [
"src/*/+(index|worker|*.worker).ts",
],
dts: true,
format: 'esm',
splitting: false,
sourcemap: true,
clean: true,
}
])
```

Results in `src/foobar.ts` being built to `dist/foobar/index.mjs`, but the .d.ts file still gets built in `dist/foobar.d.ts` which is *totally* useless.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.