nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.47k stars 2.34k forks source link

Defining any targetDefaults in nx.json override extended config #21659

Open Elyahou opened 8 months ago

Elyahou commented 8 months ago

Current Behavior

If a workspace extends configuration in nx.json and also define some targetDefaults, the extended targetDefaults get overrided.

Expected Behavior

The extended config is not entirely overrided but is merged with the config defined in nx.json

GitHub Repo

No response

Steps to Reproduce

  1. Having a package A that expose nx config with targetDefaults and a NX workspace B that extends the config from package A in its nx.json file.
  2. Workspace B also define some targetDefaults in ints nx.json file.
  3. The targetDefaults from A will be overrided entirely

Nx Report

-

Failure Logs

No response

Package Manager Version

-

Operating System

Additional Information

Fix: Replace shallow merge with deep merge here: https://github.com/nrwl/nx/blob/7409125639cdf6d9f21fd9fa63d2b92f95669c28/packages/nx/src/generators/utils/nx-json.ts#L24-L26

Elyahou commented 3 months ago

Is there any news about this issue ?