buildLibsFromSource: false
doesn't work with Vite executors when package.json
has no exports
field
#18459
Closed
3 of 4 tasks
Labels
Current Behavior
Suppose an app
my-app
uses the@nx/vite:dev-server
executor 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
.First of all, this fails because of #18458, but even after patching that, it still doesn't work.
The reason is that when the new
vite-tsconfig-paths
plugin tries to find the bundled module in the build artifacts of the lib, it first checks for anexports
field inpackage.json
, then formodule
andmain
, see here:nx/packages/vite/plugins/nx-tsconfig-paths.plugin.ts
Line 36 in 50a145b
When there is no
exports
field (which is currently the default for a Rollup build, for example), the check forexports
throws and the plugin falls back to using the defaulttsconfig
, not thetsconfig.generated.json
pointing at the build artifacts.Expected Behavior
my-lib
is not built from source, but its build artifact is used instead.GitHub Repo
No response
Steps to Reproduce
@nx/vite
to fixbuildLibsFromSource: false
doesn't work with Vite dev-server executor #18458 by replacingcontext.targetName
with'build'
inexecutor-utils
"buildLibsFromSource": false
for theserve
target of the appNx Report
Failure Logs
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: