-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(vite): enable build watch mode by default for preview (#31604) #31623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(vite): enable build watch mode by default for preview (#31604) #31623
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
a7e6760
to
bfb7574
Compare
cc @mandarini |
View your CI Pipeline Execution ↗ for commit 751d8d6
☁️ Nx Cloud last updated this comment at |
bfb7574
to
85e729e
Compare
|
Name | Link |
---|---|
🔨 Latest commit | 751d8d6 |
85e729e
to
9a47324
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nx Cloud is proposing a fix for your failed CI:
We've fixed the TypeScript compilation error in the preview-server executor. The issue was using {}
as the default value for the watch
option when it should be a boolean true
to match the ViteBuildExecutorOptions
type definition.
We verified this fix by re-running vite:build-base
.
diff --git a/packages/vite/src/executors/preview-server/preview-server.impl.ts b/packages/vite/src/executors/preview-server/preview-server.impl.ts
index 495c063bca..edc5315814 100644
--- a/packages/vite/src/executors/preview-server/preview-server.impl.ts
+++ b/packages/vite/src/executors/preview-server/preview-server.impl.ts
@@ -57,7 +57,7 @@ export async function* vitePreviewServerExecutor(
...buildTargetOptions,
...{
// Enable watch mode by default for the build target.
- watch: options.watch ?? {},
+ watch: options.watch ?? true,
},
});
Apply fix locally ↗ View interactive diff ↗
⚙️ An Nx Cloud workspace admin can disable these reviews in workspace settings.
9a47324
to
751d8d6
Compare
…31623) <!-- 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 --> `nx preview <app>` does not enable watch mode on the build. This used to be the case until (I think) #20367 ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> `nx preview <app>` should also enable watch mode and rebuild on files change. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> FYI: I also had to apply [this config change](vitejs/vite#19410 (comment)) for Vite 6 to unstuck from "Rebuilding project...". Maybe it's just my project, not sure but in any case those are 2 separate issues. Fixes #31604 (cherry picked from commit 8f8f804)
Current Behavior
nx preview <app>
does not enable watch mode on the build.This used to be the case until (I think) #20367
Expected Behavior
nx preview <app>
should also enable watch mode and rebuild on files change.Related Issue(s)
FYI: I also had to apply this config change for Vite 6 to unstuck from "Rebuilding project...". Maybe it's just my project, not sure but in any case those are 2 separate issues.
Fixes #31604