Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: async fs calls in resolve and package handling #15211

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Revert "test: check if windows in CI is happy forcing fs.realpathSync"
This reverts commit 06462a8.
  • Loading branch information
patak-dev committed Dec 2, 2023
commit 664284b39b0fa1ee56d09f207d54d0f753d47888
6 changes: 2 additions & 4 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs'
import fsp from 'node:fs/promises'
import os from 'node:os'
import path from 'node:path'
// import { exec } from 'node:child_process'
import { exec } from 'node:child_process'
import { createHash } from 'node:crypto'
import { URL, URLSearchParams, fileURLToPath } from 'node:url'
import { builtinModules, createRequire } from 'node:module'
Expand Down Expand Up @@ -629,13 +629,12 @@ export function copyDir(srcDir: string, destDir: string): void {
// `fs.realpathSync.native` resolves differently in Windows network drive,
// causing file read errors. skip for now.
// https://github.com/nodejs/node/issues/37737
export const safeRealpath = isWindows ? realpathFallback : fsp.realpath
export let safeRealpath = isWindows ? windowsSafeRealPath : fsp.realpath

async function realpathFallback(path: string) {
return fs.realpathSync(path)
}

/*
// Based on https://github.com/larrybahr/windows-network-drive
// MIT License, Copyright (c) 2017 Larry Bahr
const windowsNetworkMap = new Map()
Expand Down Expand Up @@ -693,7 +692,6 @@ async function optimizeSafeRealPath() {
}
})
}
*/

export function ensureWatchedFile(
watcher: FSWatcher,
Expand Down
Loading