Skip to content

Commit

Permalink
fix: "EISDIR: illegal operation on a directory, realpath" error on RA… (
Browse files Browse the repository at this point in the history
#13655)

Co-authored-by: patak <[email protected]>
  • Loading branch information
datacutter and patak-dev authored Jul 18, 2023
1 parent 6dca41c commit 6bd5434
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,17 @@ function optimizeSafeRealPathSync() {
safeRealpathSync = fs.realpathSync
return
}

// Check the availability `fs.realpathSync.native`
// in Windows virtual and RAM disks that bypass the Volume Mount Manager, in programs such as imDisk
// get the error EISDIR: illegal operation on a directory
try {
fs.realpathSync.native(path.resolve('./'))
} catch (error) {
if (error.message.includes('EISDIR: illegal operation on a directory')) {
safeRealpathSync = fs.realpathSync
return
}
}
exec('net use', (error, stdout) => {
if (error) return
const lines = stdout.split('\n')
Expand Down

0 comments on commit 6bd5434

Please sign in to comment.