Current Behavior
#29670 was not fixed
This bug exists since Nx 20.3 and has blocked us from upgrading. Our exports generally looks like this:
"exports": {
"./package.json": "./package.json",
"./*.js": "./dist/*.js",
"./*": "./src/*"
},
and build is not inferred unless I add an . entry point. In our repo only a handful of packages have that entry point. nx show projects --with-target build essentially produces a list of packages that either lack exports or specify .
nx.json has this config, which matches the one on https://nx.dev/technologies/typescript/introduction
"plugins": [
{
"plugin": "@nx/js/typescript",
"options": {
"build": {
"configName": "tsconfig.lib.json"
}
}
}
],
My solution was to add a fictitious entry point that satisfies Nx and points to this bug:
"exports": {
"./package.json": "./package.json",
"./*.js": "./dist/*.js",
"./*": "./src/*",
+ ".": "./dist/https://github.com/nrwl/nx/issues/29670"
},
Expected Behavior
build should be inferred even with packages that lack an . exports
GitHub Repo
No response
Steps to Reproduce
- Create Nx monorepo with one TS library
- Specify
"exports": {"./*.js", "./dist/*.js"}
- Run
nx build the-lib and see it fail because build doesn't exist
Nx Report
Node : 22.18.0
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.9.3
nx : 21.3.11
@nx/js : 21.3.11
@nx/eslint : 21.3.11
@nx/workspace : 21.3.11
@nx/devkit : 21.3.11
typescript : 5.9.2
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/eslint/plugin
./scripts/nx/jest-plugin.ts
./scripts/nx/vitest-plugin.ts
---------------------------------------
Cache Usage: 455.18 KB / 92.64 GB
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
Current Behavior
#29670 was not fixed
This bug exists since Nx 20.3 and has blocked us from upgrading. Our exports generally looks like this:
and build is not inferred unless I add an
.entry point. In our repo only a handful of packages have that entry point.nx show projects --with-target buildessentially produces a list of packages that either lackexportsor specify.nx.json has this config, which matches the one on https://nx.dev/technologies/typescript/introduction
My solution was to add a fictitious entry point that satisfies Nx and points to this bug:
"exports": { "./package.json": "./package.json", "./*.js": "./dist/*.js", "./*": "./src/*", + ".": "./dist/https://github.com/nrwl/nx/issues/29670" },Expected Behavior
buildshould be inferred even with packages that lack an.exportsGitHub Repo
No response
Steps to Reproduce
"exports": {"./*.js", "./dist/*.js"}nx build the-liband see it fail becausebuilddoesn't existNx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response