Skip to content

devExports: add bin to publishConfig #908

@Chewie

Description

@Chewie

Clear and concise description of the problem

Inside the exports configuration, the options devExports and bin do not play nice: while the exports do have a dual "src in exports"/"dist in publishConfig/exports", this is not the case for the bin, which only has the dist variant directly in the package.json "bin", and nothing in "publishConfig".

For example:

import { defineConfig } from "tsdown";

export default defineConfig({
  exports: {
    devExports: true,
    bin: {
      mybin: "./src/run.ts",
    },
  },
});

will produce in package.json:

"bin": {
  "mybin": "./dist/run.js"
}

According to https://pnpm.io/package_json#publishconfig, we can override "bin" in "publishConfig".

Suggested solution

It would be great if "bin" had the same behavior as exports, and would instead produce this:

"bin": {
  "mybin": "./src/run.ts"
},
"publishConfig": {
  "bin": {
    "mybin": "./dist/run.js"
  }
}

Cheers!

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions