Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript plugin doesn't find buildable project unless all package.json exports point to built source files #29670

Open
1 of 4 tasks
rmunch opened this issue Jan 18, 2025 · 0 comments

Comments

@rmunch
Copy link

rmunch commented Jan 18, 2025

Current Behavior

With this change that landed in v20.3.2, the TypeScript plugin no longer infers a build target if the package.json exports field exposes any module that isn't located within the resolved TypeScript outDir.

Expected Behavior

I've got JavaScript modules in the project that live outside the outDir and aren't part of the TypeScript build that I'd like to export in addition to built files. From the code comment, it sounds like the current behavior is intentional, but I'm not sure how I can proceed with my intention. Thanks!

GitHub Repo

No response

Steps to Reproduce

  1. Create a module outside the TypeScript outDir, i.e. a file that is not part of the TypeScript build. For example, if I've got TypeScript configured to build everything in the src directory in my project, add a file like test.js in the root of the project.
  2. Add that file to package.json exports.
  3. Observe the TypeScript plugin no longer infers a build target.

Nx Report

Node           : 20.18.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.5.1

nx             : 20.3.2
@nx/js         : 20.3.2
@nx/jest       : 20.3.2
@nx/workspace  : 20.3.2
@nx/devkit     : 20.3.2
typescript     : 5.5.4
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/jest/plugin
@nx/jest/plugin
@nx/jest/plugin

Failure Logs

Package Manager Version

No response

Operating System

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

Additional Information

No response

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

No branches or pull requests

1 participant