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

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

Open arthurvanl opened 4 months ago

arthurvanl commented 4 months ago

My tsup.config.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 Generates this weird file name

My file structure: image

My tsconfig:

{
  "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:

{
  "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

Upvote & Fund

Fund with Polar