Skip to content

fix(vite): isPreview=true for Vite Preview server#34597

Merged
jaysoo merged 1 commit intonrwl:masterfrom
nkalinov:vite-preview-isPreview-true
Feb 25, 2026
Merged

fix(vite): isPreview=true for Vite Preview server#34597
jaysoo merged 1 commit intonrwl:masterfrom
nkalinov:vite-preview-isPreview-true

Conversation

@nkalinov
Copy link
Copy Markdown
Contributor

Current Behavior

Given the following Vite config:

import { defineConfig } from 'vite';

export default defineConfig((config) => {
  console.log(config);
  return {};
});

npx nx preview logs:

{
  mode: 'development',
  command: 'build',
  isSsrBuild: false,
  isPreview: false
}

Expected Behavior

npx nx preview should log:

{
  mode: 'development',
  command: 'build',
  isSsrBuild: false,
  isPreview: true
}

Related Issue(s)

vitejs/vite#15694

Fixes #

@nkalinov nkalinov requested a review from a team as a code owner February 25, 2026 11:42
@nkalinov nkalinov requested a review from jaysoo February 25, 2026 11:42
@netlify
Copy link
Copy Markdown

netlify bot commented Feb 25, 2026

Deploy Preview for nx-docs canceled.

Name Link
🔨 Latest commit 99b9b1f
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/699ee0208e724f0008af54aa

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 25, 2026

Deploy Preview for nx-dev canceled.

Name Link
🔨 Latest commit 99b9b1f
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/699ee0201199ed00086e9b83

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Feb 25, 2026

View your CI Pipeline Execution ↗ for commit 99b9b1f

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 1h 7m 57s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 10s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-25 15:43:25 UTC

@jaysoo jaysoo merged commit 1e1a8a7 into nrwl:master Feb 25, 2026
24 checks passed
FrozenPandaz pushed a commit that referenced this pull request Feb 26, 2026
<!-- 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
Given the following Vite config:
```ts
import { defineConfig } from 'vite';

export default defineConfig((config) => {
  console.log(config);
  return {};
});
```

`npx nx preview` logs:
```ts
{
  mode: 'development',
  command: 'build',
  isSsrBuild: false,
  isPreview: false
}
```

## Expected Behavior
`npx nx preview` should log:
```ts
{
  mode: 'development',
  command: 'build',
  isSsrBuild: false,
  isPreview: true
}
```

## Related Issue(s)
vitejs/vite#15694

Fixes #

(cherry picked from commit 1e1a8a7)
FrozenPandaz pushed a commit that referenced this pull request Feb 26, 2026
<!-- 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
Given the following Vite config:
```ts
import { defineConfig } from 'vite';

export default defineConfig((config) => {
  console.log(config);
  return {};
});
```

`npx nx preview` logs:
```ts
{
  mode: 'development',
  command: 'build',
  isSsrBuild: false,
  isPreview: false
}
```

## Expected Behavior
`npx nx preview` should log:
```ts
{
  mode: 'development',
  command: 'build',
  isSsrBuild: false,
  isPreview: true
}
```

## Related Issue(s)
vitejs/vite#15694

Fixes #

(cherry picked from commit 1e1a8a7)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants