Skip to content

Conversation

@Nitin75408
Copy link

… project root

Previously, isAnyEntryPointPointingToOutDir in the TypeScript plugin assumed that if outDir resolves to a path outside the project root, the package is automatically buildable. This caused incorrect behavior when users have base tsconfig in non-standard directories (like .config/), because TypeScript resolves outDir relative to the config file containing it.

The fix removes the short-circuit logic and always validates that package.json exports actually point to the resolved outDir.

Closes #34243

Current Behavior

The isAnyEntryPointPointingToOutDir function in the @nx/js/typescript plugin assumes that if outDir resolves to a path outside the project root, the package is automatically buildable. This causes incorrect behavior when:

  1. Users have base tsconfig.json in non-standard directories (like .config/)
  2. The base config has outDir: "dist" which TypeScript resolves relative to the base config directory
  3. The resolved outDir becomes .config/dist instead of packages/mylib/dist
  4. The plugin incorrectly marks packages as buildable even when their package.json exports don't point to the actual output directory

Expected Behavior

The plugin should always validate that package.json exports actually point to files inside the resolved outDir, regardless of whether the outDir is inside or outside the project root.

With this fix:

  • Packages with exports pointing to the correct outDir are correctly identified as buildable
  • Packages with exports pointing to source files (not outDir) are correctly identified as non-buildable
  • Users with non-standard config directories (like .config/) get correct build target inference when they properly override outDir in their project's tsconfig

Related Issue(s)

Fixes #34243

… project root

Previously, `isAnyEntryPointPointingToOutDir` in the TypeScript plugin assumed
that if `outDir` resolves to a path outside the project root, the package is
automatically buildable. This caused incorrect behavior when users have base
tsconfig in non-standard directories (like `.config/`), because TypeScript
resolves `outDir` relative to the config file containing it.

The fix removes the short-circuit logic and always validates that package.json
exports actually point to the resolved outDir.

Closes nrwl#34243
@Nitin75408 Nitin75408 requested a review from a team as a code owner February 1, 2026 12:14
@Nitin75408 Nitin75408 requested a review from Coly010 February 1, 2026 12:14
@netlify
Copy link

netlify bot commented Feb 1, 2026

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a2ace49

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nx-dev Ready Ready Preview Feb 1, 2026 0:22am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nx JS TypeScript Plugin Not Inferring Tasks

1 participant