egoist / egoist/tsup

Why is tsup making a declaration file with a file name I dont have

Open
#1,084 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

My tsup.config.ts:

```ts
import { defineConfig } from "tsup";

export default defineConfig({
name: 'tsup',
entry: ["src/index.ts"],
dts: {
resolve: true,
entry: ['src/index.ts', "src/types/index.ts"]
},
splitting: false,
clean: true,
format: 'esm',
sourcemap: false,
})
```

![image](https://github.com/egoist/tsup/assets/20114845/16f8ced0-e145-4acc-bc47-39533dc0c1f7)
Generates this weird file name

My file structure:
![image](https://github.com/egoist/tsup/assets/20114845/c199473f-cf3a-48f6-8418-5fc1c17906ba)

My tsconfig:

```json
{
"compilerOptions": {
"lib": [
"ESNext"
],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": false,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"types": [
"bun-types" // add Bun global
]
}
}
```

My package.json:

```json
{
"name": "@mintymedia/utils",
"description": "A collection of utilities for Minty Media",
"version": "0.0.17",
"module": "src/index.ts",
"type": "module",
"main": "dist/index.js",
"scripts": {
"format": "bun x prettier src --write",
"format:check": "bun x prettier src --check",
"lint": "tsc",
"build": "tsup",
"test": "bun test",
"test:watch": "bun test --watch",
"release": "bun x changeset publish"
},
"license": "MIT",
"files": ["dist"],
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/bun": "latest",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-require-extensions": "^0.1.3",
"prettier": "^3.2.4",
"redoc-builder": "^1.1.2",
"tsup": "^8.0.1",
"zod": "^3.22.4"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"mysql2": "^3.9.0"
}
}
```

I would like to have build the files in the following file structure:

dist
- types
- index.d.ts
- index.d.ts
- index.js

Contributor guide

Open the contributing guide

Research direction

Start with tsup.config.ts, especially the dts entries for src/index.ts and src/types/index.ts, then compare the generated declaration paths with the project structure and the requested dist layout. Check how the tsconfig.json and package.json settings affect declaration naming; done means the build produces dist/index.d.ts, dist/index.js, and dist/types/index.d.ts without the unexpected filename.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.