Skip to content

Commit

Permalink
feat: vitest deps.experimentalOptimizer (vitejs#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Jun 4, 2023
1 parent ec3032a commit b528c3b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
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

0 comments on commit b528c3b

Please sign in to comment.