Skip to content

fix(packaging): published packages expose "development" export condition pointing to missing src/ files (v8.6.0+) #3216

@pedrotainha

Description

@pedrotainha

Description

Since v8.6.0, all published @orval/* packages on npm contain a "development" export condition in their package.json that points to TypeScript source files (./src/index.ts). These source files are not included in the published tarball (the files field only includes dist/).

Any bundler or runtime that activates the "development" condition — such as Vite in dev mode, or a tsconfig.json with "customConditions": ["development"] — will resolve @orval/core (and other @orval/* packages) to ./src/index.ts, which does not exist, causing a runtime error:

Error: Cannot find module '.../node_modules/@orval/core/src/index.ts'

Root cause: Commit 82fde637 changed packages/tsdown.base.ts from exports: true to exports: { devExports: 'development' }, which made tsdown auto-generate "development": "./src/index.ts" in the exports field of every package. A publishConfig.exports block was added to override this during publish, but the CI uses bun publish (release-publish.yaml L60), which does not apply publishConfig.exports — unlike npm publish.

Proof from the published tarball (npm pack @orval/core@8.7.0):

"exports": {
  ".": {
    "development": "./src/index.ts",
    "default": "./dist/index.mjs"
  }
}

In v8.5.3 this was simply:

"exports": {
  ".": "./dist/index.mjs"
}

Affected versions: 8.6.0, 8.6.1, 8.6.2, 8.7.0
Affected packages: All 12 published packages in the monorepo (core, orval, angular, axios, fetch, hono, mcp, mock, query, solid-start, swr, zod).

Output client

other

Configuration (orval.config)

// Any config triggers the bug when using a bundler that activates
// the "development" export condition (e.g., Vite dev mode).
export default defineConfig({
  api: {
    input: { target: "./openapi.yaml" },
    output: {
      client: "react-query",
      target: "src/api",
    },
  },
});

Environment

  System:
    OS: macOS 13.5
    CPU: Apple M1
    Node: v24.14.0
  npmPackages:
    orval: 8.7.0

Expected behavior

All @orval/* packages should resolve to compiled dist/ files regardless of the consumer's export conditions. The published package.json should not contain a "development" condition pointing to files that are excluded from the tarball.

Actual behavior

Error: Cannot find module '.../node_modules/@orval/core/src/index.ts'
imported from .../node_modules/orval/dist/config-CO914zjc.mjs

Node/bundler follows the "development" export condition → ./src/index.ts → file not found.

Additional context

Proposed fix: Revert packages/tsdown.base.ts to exports: true (removes the "development" condition from all packages) and remove the now-unnecessary publishConfig.exports blocks. Dev-mode DX is already covered by tsdown --watch.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions