Skip to content

Commit

Permalink
perf: temporary hack to avoid fs checks for /@react-refresh (#15299)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev authored Dec 12, 2023
1 parent 08d093c commit b1d6211
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
url = resolved.id.slice(root.length)
} else if (
depsOptimizer?.isOptimizedDepFile(resolved.id) ||
(path.isAbsolute(cleanUrl(resolved.id)) &&
// vite-plugin-react isn't following the leading \0 virtual module convention.
// This is a temporary hack to avoid expensive fs checks for React apps.
// We'll remove this as soon we're able to fix the react plugins.
(resolved.id !== '/@react-refresh' &&
path.isAbsolute(resolved.id) &&
fsUtils.existsSync(cleanUrl(resolved.id)))
) {
// an optimized deps may not yet exists in the filesystem, or
Expand Down

0 comments on commit b1d6211

Please sign in to comment.