Skip to content

Commit b1d6211

Browse files
authored
perf: temporary hack to avoid fs checks for /@react-refresh (#15299)
1 parent 08d093c commit b1d6211

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/vite/src/node/plugins/importAnalysis.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
338338
url = resolved.id.slice(root.length)
339339
} else if (
340340
depsOptimizer?.isOptimizedDepFile(resolved.id) ||
341-
(path.isAbsolute(cleanUrl(resolved.id)) &&
341+
// vite-plugin-react isn't following the leading \0 virtual module convention.
342+
// This is a temporary hack to avoid expensive fs checks for React apps.
343+
// We'll remove this as soon we're able to fix the react plugins.
344+
(resolved.id !== '/@react-refresh' &&
345+
path.isAbsolute(resolved.id) &&
342346
fsUtils.existsSync(cleanUrl(resolved.id)))
343347
) {
344348
// an optimized deps may not yet exists in the filesystem, or

0 commit comments

Comments
 (0)