-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
@nx/esbuild:esbuild with "declaration": true
always executes from $PWD
#26261
Comments
Executing esbuild-backed targets should succeed no matter what the initial working directory is. Closes nrwl#26261
It appears this issue can be fixed by specifying a path for It appears there is an issue in the @nx/esbuild package (executers/esbuild/esbuild.impl.ts) within the getTypeCheckOptions function. It seems that context.root property is returning the absolute path of the workspace, causing the declarations to be written to: dist/libs/my-lib/libs/my-lib/src. As mentioned above, setting the |
I agree with @snowmandev - using |
…egardless of cwd #26261 (#27560) <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> The types that are generated for esbuild packages are not placed into the correct folder structure in the built package and is very dependent of the CWD. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The declaration files should be generated correctly to match the package and not dependent on CWD ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #26261 #26376 (cherry picked from commit c427717)
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Currently, executing
nx build my-project
where thebuild
target is executed by the@nx/esbuild:esbuild
executor with the"declaration": true
option will produce different results depending on whether you're at the{workspaceRoot}
or the{projectRoot}
.Expected Behavior
Executing a fully-specified target using the
@nx/esbuild:esbuild
executor should succeed from any$PWD
under{workspaceRoot}
.GitHub Repo
https://github.com/scottpledger/nx-esbuild-issue
Steps to Reproduce
1.1. Create an Nx workspace with
npx create-nx-workspace
and the following options:nx g @nx/js:lib test1 --directory=packages --bundler=esbuild
and the following options:"declaration": true
to theproject.json
:nx --skipNxCache build test1
. This should succeed.pushd packages/test1 ; nx --skipNxCache build test1 ; popd
. It should succeed, but instead it will fail with the following error:pushd packages/test1 ; nx --skipNxCache build ; popd
. It should succeed, but instead it will fail with the following error:Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: