buildLibsFromSource: false
doesn't work with Vite executors
#17922
Labels
buildLibsFromSource: false
doesn't work with Vite executors
#17922
Current Behavior
Suppose an app
my-app
uses the@nx/vite:build
and/or@nx/vite:dev-server
executors and depends on a libmy-lib
. Then when thebuildLibsFromSource
option of the executor is set tofalse
,my-lib
is still built from source withinmy-app
.I created a reproducible example, see below.
This seems to be caused by a combination of two faulty behaviors:
tsconfig.generated.json
file, it tries to figure out whether the lib is buildable. It does so by checking if it has a target with the same name as the target currently being executed for the app, seenx/packages/vite/src/utils/executor-utils.ts
Line 43 in 50d01d1
serve
, it looks for a target calledserve
in the lib, which doesn't make sense. The@nx/webpack:dev-server
executor uses a hard-coded'build'
here, which is probably not optimal either but should work in most cases.@nx/vite
, thetsconfig.generated.json
file is generated correctly. However, it is still not respected by the build. I haven't figured out why, but I suspect it's because Nx Vite apps use thevite-tsconfig-paths
plugin, which needs to be made aware of the generatedtsconfig
file, but isn't.Expected Behavior
my-lib
is not built from source, but its build artifact is used instead.GitHub Repo
https://github.com/ms-tng/nx-buildlibsfromsource-repro
Steps to Reproduce
"buildLibsFromSource": false
for thebuild
andserve
targets of the appNx Report
Failure Logs
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: