You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Writing the type declaration files at the correct folder even if declarationRootRir is set and the output path of the declaration contains the absolute path of the workspace.
GitHub Repo
No response
Steps to Reproduce
{
"name": "angular-administration-api",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/client-sdk/angular/administration-api/src",
"projectType": "library",
"tags": ["tech:angular"],
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"main": "libs/client-sdk/angular/package-api/src/index.ts",
"outputPath": "dist/libs/client-sdk/angular/package-api",
"outputFileName": "main.js",
"declarationRootDir": "libs/client-sdk/angular/package-api/src",
"tsConfig": "libs/client-sdk/angular/package-api/tsconfig.lib.json",
"assets": [
{
"input": "libs/client-sdk/angular/package-api",
"glob": "README.md",
"output": "/"
}
],
"platform": "node"
},
"configurations": {
"development": {
"minify": false
},
"production": {
"minify": true
}
}
}
}
}
The code of the package is located in folder libs/client-sdk/angular/package-api/src
and I need them in folder dist/libs/client-sdk/angular/package-api after build.
With this nx project, the build creates declaration files to folder dist/
and without specifing the declarationRootDir to folder dist/libs/client-sdk/angular/package-api/src
If i change the output path (dist/libs/client-sdk/angular/package-api) to not match the workspace (libs/client-sdk/angular/package-api) by changing the name of a folder (dist/libs/client-sdk-test/angular/package-api), it works fine.
Dabmuel
changed the title
@nx/esbuild:esbuild declarationRootDir not working properly when it contains
@nx/esbuild:esbuild declarationRootDir not working properly
Nov 6, 2024
Dabmuel
changed the title
@nx/esbuild:esbuild declarationRootDir not working properly
@nx/esbuild:esbuild declarationRootDir not working properly when output path matches workspace
Nov 6, 2024
Current Behavior
There was a issue with type declaration files when building a package with @nx/esbuild:esbuild. Declaration were placed at the wrong folder ( @nx/esbuild:esbuild with "declaration": true always executes from $PWD ). This could be fixed by adding option
declarationRootRir
.Recently this got fixed with this PR : [fix(esbuild): declaration:true should find the correct package root regardless of cwd](#27560) but the fix breaks the
declarationRootRir
option if the output path contains the absolute path of the workspace. I kinda need this option :/Expected Behavior
Writing the type declaration files at the correct folder even if
declarationRootRir
is set and the output path of the declaration contains the absolute path of the workspace.GitHub Repo
No response
Steps to Reproduce
{
"name": "angular-administration-api",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/client-sdk/angular/administration-api/src",
"projectType": "library",
"tags": ["tech:angular"],
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"main": "libs/client-sdk/angular/package-api/src/index.ts",
"outputPath": "dist/libs/client-sdk/angular/package-api",
"outputFileName": "main.js",
"declarationRootDir": "libs/client-sdk/angular/package-api/src",
"tsConfig": "libs/client-sdk/angular/package-api/tsconfig.lib.json",
"assets": [
{
"input": "libs/client-sdk/angular/package-api",
"glob": "README.md",
"output": "/"
}
],
"platform": "node"
},
"configurations": {
"development": {
"minify": false
},
"production": {
"minify": true
}
}
}
}
}
The code of the package is located in folder
libs/client-sdk/angular/package-api/src
and I need them in folder
dist/libs/client-sdk/angular/package-api
after build.With this nx project, the build creates declaration files to folder
dist/
and without specifing the declarationRootDir to folder
dist/libs/client-sdk/angular/package-api/src
If i change the output path (
dist/libs/client-sdk/angular/package-api
) to not match the workspace (libs/client-sdk/angular/package-api
) by changing the name of a folder (dist/libs/client-sdk-test/angular/package-api
), it works fine.Nx Report
Node : 20.16.0
OS : win32-x64
Native Target : x86_64-windows
npm : 10.8.1
nx : 19.7.2
@nx/js : 19.7.2
@nx/jest : 19.7.2
@nx/linter : 19.7.2
@nx/eslint : 19.7.2
@nx/workspace : 19.7.2
@nx/angular : 19.7.2
@nx/cypress : 19.7.2
@nx/devkit : 19.7.2
@nx/esbuild : 19.7.2
@nx/eslint-plugin : 19.7.2
@nx/nest : 19.7.2
@nx/node : 19.7.2
@nrwl/tao : 19.7.2
@nx/web : 19.7.2
@nx/webpack : 19.7.2
typescript : 5.5.4
Community plugins:
devextreme-angular : 24.1.5
ngx-bootstrap : 18.0.2
ngx-toastr : 19.0.0
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: