fix(js): improve @nx/js/typescript plugin check for buildable libraries#32405
Merged
leosvelperez merged 1 commit intomasterfrom Aug 19, 2025
Merged
fix(js): improve @nx/js/typescript plugin check for buildable libraries#32405leosvelperez merged 1 commit intomasterfrom
@nx/js/typescript plugin check for buildable libraries#32405leosvelperez merged 1 commit intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
View your CI Pipeline Execution ↗ for commit 36fa48c
☁️ Nx Cloud last updated this comment at |
Coly010
approved these changes
Aug 19, 2025
FrozenPandaz
pushed a commit
that referenced
this pull request
Aug 22, 2025
…ries (#32405) ## Current Behavior The `@nx/js/typescript` plugin exhibits the following wrong behaviors when it comes to determining whether a project is buildable: - Having a custom conditional export other than `development` pointing to a source file means the project is not buildable - Having any conditional export pointing to source files means the project is not buildable - It falls back to check against included files when `outDir` is defined The above creates issues where some buildable libraries are not identified. ## Expected Behavior The `@nx/js/typescript` plugin should behave as follows (simplified) when it comes to determining whether a project is buildable: - If `outFile` is defined: - If the `.` entry point is defined and it's pointing to the `outFile` or any of its conditional exports are pointing to the `outFile`, it's buildable - If `exports` is not defined and `main` or `module` are defined and pointing to the `outFile`, it's buildable - Otherwise, it's not buildable - Otherwise, if `outDir` is defined: - If the `.` entry point is defined and it's pointing to a path contained in the `outDir` or any of its conditional exports are pointing to a path contained in the `outDir`, it's buildable - If `exports` is not defined and `main` or `module` are defined and pointing to a path contained in the `outDir`, it's buildable - Otherwise, it's not buildable - Otherwise (no `outFile` and no `outDir`): - If the `.` entry point is defined and it's pointing to a path not matched by the `files` or `include` patterns or any of its conditional exports are pointing to a path not matched by the `files` or `include` patterns, it's buildable - If `exports` is not defined and `main` or `module` are defined and pointing to a path not matched by the `files` or `include` patterns, it's buildable - Otherwise, it's not buildable The above also ensures that custom conditional exports are not a factor, given that all that is needed is that at least one conditional export is deemed non-buildable. ## Related Issue(s) Fixes #32116 Fixes #32290 (cherry picked from commit 4bf937e)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
The
@nx/js/typescriptplugin exhibits the following wrong behaviors when it comes to determining whether a project is buildable:developmentpointing to a source file means the project is not buildableoutDiris definedThe above creates issues where some buildable libraries are not identified.
Expected Behavior
The
@nx/js/typescriptplugin should behave as follows (simplified) when it comes to determining whether a project is buildable:outFileis defined:.entry point is defined and it's pointing to theoutFileor any of its conditional exports are pointing to theoutFile, it's buildableexportsis not defined andmainormoduleare defined and pointing to theoutFile, it's buildableoutDiris defined:.entry point is defined and it's pointing to a path contained in theoutDiror any of its conditional exports are pointing to a path contained in theoutDir, it's buildableexportsis not defined andmainormoduleare defined and pointing to a path contained in theoutDir, it's buildableoutFileand nooutDir):.entry point is defined and it's pointing to a path not matched by thefilesorincludepatterns or any of its conditional exports are pointing to a path not matched by thefilesorincludepatterns, it's buildableexportsis not defined andmainormoduleare defined and pointing to a path not matched by thefilesorincludepatterns, it's buildableThe above also ensures that custom conditional exports are not a factor, given that all that is needed is that at least one conditional export is deemed non-buildable.
Related Issue(s)
Fixes #32116
Fixes #32290