-
fix(js): resolve build output dir from globbed outputs in node executor (#35288)
发布于
2026-04-21 13:32:32 +00:00 Current Behavior
The
@nx/js:nodeexecutor fails when combined with the inferred
@nx/js/typescriptbuild target — in two distinct ways:- Script-to-run resolution: fails with
Could not find <project>/dist/**/*.{js,cjs,mjs,jsx,d.ts,d.cts,d.mts}{,.map}/main.js. Make sure your build succeeded.— the executor'sgetFileToRunwas
appendingmain.jsonto the glob output pattern. - Buildable-dep import resolution: when the node app imports a
buildable lib that also uses the inferred build target,
require('@scope/my-lib')throwsMODULE_NOT_FOUNDbecause
calculateResolveMappingspasses the literal glob intoNX_MAPPINGS,
which the CJS require override / ESM loader then tries to resolve.
Both regressed after #35041 narrowed the inferred build target's
outputs[0]from{projectRoot}/distto
{projectRoot}/dist/**/*.{js,...}{,.map}(to prevent cross-OS cache
pollution).Expected Behavior
outputsentries are cache patterns and may legitimately contain globs.
The node executor now strips the glob portion back to the last path
separator before using the value as a directory, in bothgetFileToRun
andcalculateResolveMappings. Handles**,*,?, character
classes, brace expansion, extglob, and Windows/POSIX separators.Related Issue(s)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
下载附件
- Script-to-run resolution: fails with