fix(vite): prevent watch false leaking into dev server config - #36080
Merged
leosvelperez merged 2 commits intoJul 17, 2026
Conversation
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
Closed
4 tasks
Contributor
|
View your CI Pipeline Execution ↗ for commit 4891124
☁️ Nx Cloud last updated this comment at |
Contributor
There was a problem hiding this comment.
Nx Cloud has identified a flaky task in your failed CI:
Since the failure was identified as flaky, the solution is to rerun CI. Because this branch comes from a fork, it is not possible for us to push directly, but you can rerun by pushing an empty commit:
git commit --allow-empty -m "chore: trigger rerun"
git push
🎓 Learn more about Self-Healing CI on nx.dev
FrozenPandaz
pushed a commit
that referenced
this pull request
Jul 20, 2026
Closes #36078 <!-- 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 When the Vite dev-server executor references a build target with a named configuration, the build target options can include `watch: false`. That value is currently merged into the Vite dev-server config as `server.watch: false`. `watch: false` is valid for the Nx build executor, but it is not a valid/useful value for Vite dev-server `server.watch`. This can cause downstream Vite plugins to fail when they expect `server.watch` to be unset or an object. For example, plugins may safely initialise missing watch config with: ```ts config.server ??= {}; config.server.watch ??= {}; ``` However, if `config.server.watch` is `false`, the nullish assignment does not replace it. The plugin can then fail when trying to read or assign properties such as `config.server.watch.ignored`. ## Expected Behavior The Vite dev-server executor should not forward `watch: false` into Vite’s `server.watch` config. This patch normalises `false` to `undefined` when resolving the watch option from the referenced build target and dev-server options. This keeps the existing precedence behaviour while preventing the invalid boolean value from leaking into the Vite server config. Valid watch option objects continue to be passed through unchanged. ## Related Issue(s) Fixes #36078 (cherry picked from commit b71cf87)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36078
Current Behavior
When the Vite dev-server executor references a build target with a named configuration, the build target options can include
watch: false.That value is currently merged into the Vite dev-server config as
server.watch: false.watch: falseis valid for the Nx build executor, but it is not a valid/useful value for Vite dev-serverserver.watch. This can cause downstream Vite plugins to fail when they expectserver.watchto be unset or an object.For example, plugins may safely initialise missing watch config with:
However, if
config.server.watchisfalse, the nullish assignment does not replace it. The plugin can then fail when trying to read or assign properties such asconfig.server.watch.ignored.Expected Behavior
The Vite dev-server executor should not forward
watch: falseinto Vite’sserver.watchconfig.This patch normalises
falsetoundefinedwhen resolving the watch option from the referenced build target and dev-server options.This keeps the existing precedence behaviour while preventing the invalid boolean value from leaking into the Vite server config. Valid watch option objects continue to be passed through unchanged.
Related Issue(s)
Fixes #36078