-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b6c08e
commit fb76aaf
Showing
10 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ | |
}, | ||
"files": [ | ||
"dist", | ||
"setup", | ||
"bin", | ||
"*.d.ts", | ||
"*.d.cts", | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if (typeof window !== 'undefined') { | ||
const { default: RefreshRuntime } = await import('/@react-refresh') | ||
|
||
RefreshRuntime.injectIntoGlobalHook(window) | ||
window.$RefreshReg$ = () => {} | ||
window.$RefreshSig$ = () => type => type | ||
window.__vite_plugin_react_preamble_installed__ = true | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Plugin } from 'vite' | ||
import { resolve } from 'pathe' | ||
import { hasVitePlugin } from '../../utils/config-helpers' | ||
import { distDir } from '../../paths' | ||
|
||
export function CommonPluginsHandler(): Plugin { | ||
return { | ||
name: 'vitest:common-plugins-enforcer', | ||
enforce: 'post', | ||
config: { | ||
order: 'post', | ||
async handler(config) { | ||
const plugins = (config.plugins || []) | ||
const hasReact = await hasVitePlugin(plugins, 'vite:react-babel') | ||
if (hasReact) { | ||
return { | ||
test: { | ||
deps: { | ||
inline: [/vitest\/setup\/react-refresh.js/], | ||
}, | ||
// Since this is an official plugin, it should be OK to inline reac-refresh HRM logic | ||
setupFiles: [resolve(distDir, '../setup/react-refresh.js')], | ||
}, | ||
} | ||
} | ||
}, | ||
}, | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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