Skip to content

Renaming the development export condition causes library to be non-buildable #32116

@danewilson

Description

@danewilson

Current Behavior

Renaming the default development export condition in a buildable library's package.json causes Nx to treat the library as non-buildable.

Expected Behavior

The development export condition can be renamed without making the library non-buildable.

GitHub Repo

https://github.com/danewilson/nx-bugs

Steps to Reproduce

  1. Open packages/external-package/package.json and rename exports['.']['development'] to something unique like @nx-bugs/source.
  2. Attempt to run nx build external-package.

Nx Report

Node           : 24.4.1
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 1.22.22

nx (global)        : 21.3.7
nx                 : 21.3.8
@nx/js             : 21.3.8
@nx/jest           : 21.3.8
@nx/eslint         : 21.3.8
@nx/workspace      : 21.3.8
@nx/devkit         : 21.3.8
@nx/eslint-plugin  : 21.3.8
@nx/nest           : 21.3.8
@nx/node           : 21.3.8
@nx/web            : 21.3.8
@nx/webpack        : 21.3.8
typescript         : 5.8.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
Cache Usage: 21.90 KB / 92.64 GB

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

I think this is caused by this logic. Perhaps this logic could look at the root tsconfig.base.json and use the value(s) of customConditions instead of hardcoding development.

We want to rename this condition because it's not a unique condition, so if we use this package outside our monorepo, other repos (e.g. other Nx repos) or tools (like Webpack) that use the same condition will resolve our source files instead of our built files, which we don't want. I think a more sensible default could be using the same name as the root package.json, e.g. @my-repo-name/source.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions