Skip to content

Commit

Permalink
chore: only apply the workaround for /@react-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 12, 2023
1 parent 877b184 commit 6f4224c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,9 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
url = resolved.id.slice(root.length)
} else if (
depsOptimizer?.isOptimizedDepFile(resolved.id) ||
// resolved virtual id convention, ie /@vite/client, /@react-refresh, /@vite-plugin-pwa
// We don't support absolute paths starting with `/@` at the root of the file system to avoid
// expensive fs checks
(!resolved.id.startsWith('/@') &&
// vite-plugin-react isn't following the leading \0 virtual module convention
// this is a temporal workaround to avoid expensive fs checks for it
(resolved.id !== '/@react-refresh' &&
path.isAbsolute(resolved.id) &&
fs.existsSync(cleanUrl(resolved.id)))
) {
Expand Down

0 comments on commit 6f4224c

Please sign in to comment.