fix(bundling): Correct declarationRootDir handling for esbuild
Refine declarationDir logic for esbuild plugin as follows
- IF no custom declaration root AND outDir structure mirrors {projectRoot} e.g if project root packages/mylib and output directory is dist/packages/mylib THEN we adjust declarationDir to place types in outDir
- ELSE if we have specified a custom declarationRootDir, place declarations in outDir
Add test to check for the case when declarationDir id specified.
Closes #28814.
Current Behavior
As reported in #28814, the esbuild plugin declarationRootDir configuration was/is not working properly when output path matches workspace.
Expected Behavior
When specifying the esbuild plugin declarationRootDir configuration setting, this setting should be honoured when types are generated AND the generated types should be placed in the configured output path.
The specific new behaviour is detail in the PR outline above.
Related Issue(s)
Fixes #28814.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| nx-dev | ✅ Ready (Inspect) | Visit Preview | Jun 9, 2025 9:47am |
View your CI Pipeline Execution ↗ for commit 895496916f5df0e1fe6abbd8b7c45d50eec30e30.
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=lint,test,build,e2e,e2e-c... |
❌ Failed | 33m 34s | View ↗ |
nx run-many -t check-imports check-commit check... |
✅ Succeeded | 17s | View ↗ |
nx-cloud record -- nx-cloud conformance:check |
✅ Succeeded | 2s | View ↗ |
nx-cloud record -- nx format:check |
✅ Succeeded | 3s | View ↗ |
nx-cloud record -- nx sync:check |
✅ Succeeded | 2s | View ↗ |
nx documentation |
✅ Succeeded | 2m 20s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-06-09 10:17:05 UTC
Not sure how to address the "Workflow does not have enough agents to satisfy all assignment rules." CI error. It appears build system not code error related.
Unfortunately, there does not seem to be a straightforward way to implement this without causing further failures, and as this has sat now for some time without additional attention, I'm going to close this PR.
Please know I very much appreciate the time spent on this PR originally, and if you would like to open a new one, I'd be more than happy to take a look.
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.