Skip to content

@nx/js adds non-input references to project references #33079

@Gijsdeman

Description

@Gijsdeman

Current Behavior

When using Nx sync, tsconfig.json files and other common runtime tsconfig files can be updated to include references that are not listed in any of the inputs defined in those config files.

Expected Behavior

When using Nx sync, any updates to tsconfig.json or shared runtime tsconfig files should only include references that are already present in the corresponding input lists, ensuring consistency between project inputs and tsconfig references.

GitHub Repo

https://github.com/Gijsdeman/nx-examples

Steps to Reproduce

  1. nx reset
  2. nx sync
  3. navigate to apps/products/tsconfig.app.json
  4. observe that the test-factory reference was added to the config, even though it was not used in included (or in this specific case runtime) files

Nx Report

Node           : 22.2.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.2.2

nx (global)            : 21.5.2
nx                     : 22.0.0-beta.4
@nx/js                 : 22.0.0-beta.4
@nx/jest               : 22.0.0-beta.4
@nx/eslint             : 22.0.0-beta.4
@nx/workspace          : 22.0.0-beta.4
@nx/angular            : 22.0.0-beta.4
@nx/cypress            : 22.0.0-beta.4
@nx/devkit             : 22.0.0-beta.4
@nx/eslint-plugin      : 22.0.0-beta.4
@nx/module-federation  : 22.0.0-beta.4
@nx/react              : 22.0.0-beta.4
@nx/rollup             : 22.0.0-beta.4
@nx/rspack             : 22.0.0-beta.4
@nx/vite               : 22.0.0-beta.4
@nx/web                : 22.0.0-beta.4
@nx/webpack            : 22.0.0-beta.4
typescript             : 5.9.2
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/cypress/plugin
@nx/jest/plugin
@nx/js/typescript
@nx/js/typescript
---------------------------------------
Community plugins:
@ngrx/component-store : 20.0.1
@ngrx/effects         : 20.0.1
@ngrx/entity          : 20.0.1
@ngrx/operators       : 20.0.1
@ngrx/router-store    : 20.0.1
@ngrx/store           : 20.0.1
@ngrx/store-devtools  : 20.0.1
---------------------------------------
Cache Usage: 0.00 B / 92.64 GB

Package Manager Version

[email protected]

Operating System

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

Additional Information

tsconfig.spec.json is not updated (source code shows this is intended). However, references used in, in this instance, non-runtime files should not be added to tsconfig.lib.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions