Skip to content
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

feat: vitest deps.experimentalOptimizer #170

Merged
merged 1 commit into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: vitest deps.experimentalOptimizer
  • Loading branch information
ArnaudBarre committed Jun 4, 2023
commit 78da7d896bcc99da27df87110d5801ff1af0a903
4 changes: 4 additions & 0 deletions packages/plugin-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Support [Vitest deps.experimentalOptimizer](https://vitest.dev/config/#deps-experimentaloptimizer)

## 4.0.0 (2023-04-20)

This major version include a revamp of options:
Expand Down
5 changes: 4 additions & 1 deletion packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
devBase = config.base
projectRoot = config.root
isProduction = config.isProduction
skipFastRefresh = isProduction || config.command === 'build'
skipFastRefresh =
isProduction ||
config.command === 'build' ||
(!!process.env.TEST && !process.env.VITE_TEST_HMR)

if ('jsxPure' in opts) {
config.logger.warnOnce(
Expand Down
1 change: 1 addition & 0 deletions playground/vitestGlobalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup')
let browserServer: BrowserServer | undefined

export async function setup(): Promise<void> {
process.env.VITE_TEST_HMR = 'true' // To force HMR transformation in test environment
process.env.NODE_ENV = process.env.VITE_TEST_BUILD
? 'production'
: 'development'
Expand Down