Skip to content

Commit d1c901d

Browse files
authored
fix(js): respect "watch" option when "runBuildTargetDependencies" is true (#27677)
This PR fixes and issue when `watch: false` and `runBuildTargetDependencies: true` results in the server process restarting, but no build happens. <!-- 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 --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #20963
1 parent adcefcc commit d1c901d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/js/src/executors/node/node.impl.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ export async function* nodeExecutor(
276276
} else if (err) {
277277
logger.error(`Watch error: ${err?.message ?? 'Unknown'}`);
278278
} else {
279-
logger.info(`NX File change detected. Restarting...`);
280-
await runBuild();
279+
if (options.watch) {
280+
logger.info(`NX File change detected. Restarting...`);
281+
await runBuild();
282+
}
281283
}
282284
}
283285
);

0 commit comments

Comments
 (0)