Skip to content

Commit 965839c

Browse files
authoredApr 24, 2023
fix: use realpathSync for node <16.18 on windows (#12971)
1 parent ada7cd5 commit 965839c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎packages/vite/src/node/utils.ts

+7
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,13 @@ function windowsSafeRealPathSync(path: string): string {
586586
}
587587

588588
function optimizeSafeRealPathSync() {
589+
// Skip if using Node <16.18 due to MAX_PATH issue: https://github.com/vitejs/vite/issues/12931
590+
const nodeVersion = process.versions.node.split('.').map(Number)
591+
if (nodeVersion[0] < 16 || (nodeVersion[0] === 16 && nodeVersion[1] < 18)) {
592+
safeRealpathSync = fs.realpathSync
593+
return
594+
}
595+
589596
exec('net use', (error, stdout) => {
590597
if (error) return
591598
const lines = stdout.split('\n')

0 commit comments

Comments
 (0)
Please sign in to comment.