Skip to content

bun publish support override package.json with publishConfig like pnpm #19205

Open
@okxiaoliang4

Description

@okxiaoliang4

What is the problem this feature would solve?

In monorepo typescript project we always alias .ts file in development env to enable hot-reload.
But publish the package should set package.json exports to dist paths.

// example package.json
{
  "exports": {
        ".": "./src/index.ts",
        "./*": "./src/*"
    },
    "main": "./src/index.ts",
    "types": "./lib/types/index.d.ts",
    "publishConfig": {
        "access": "public",
        "main": "./lib/es/index.js",
        "module": "./lib/es/index.js",
        "exports": {
            ".": {
                "import": "./lib/es/index.js",
                "require": "./lib/cjs/index.js",
                "types": "./lib/types/index.d.ts"
            },
            "./*": {
                "import": "./lib/es/*",
                "require": "./lib/cjs/*",
                "types": "./lib/types/index.d.ts"
            }
        }
    },
}

What is the feature you are proposing to solve the problem?

We need the override publishConfig to improve DX.

reference:
https://pnpm.io/package_json#publishconfig

https://github.com/pnpm/pnpm/blob/7a2d7a18ed518cc1b65981d402d9ad97423557b1/pkg-manifest/exportable-manifest/src/overridePublishConfig.ts#L29-L43

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bun installSomething that relates to the npm-compatible clientenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions