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

fix: use realpathSync for node <16.18 on windows #12971

Merged
merged 1 commit into from Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/vite/src/node/utils.ts
Expand Up @@ -586,6 +586,13 @@ function windowsSafeRealPathSync(path: string): string {
}

function optimizeSafeRealPathSync() {
// Skip if using Node <16.18 due to MAX_PATH issue: https://github.com/vitejs/vite/issues/12931
const nodeVersion = process.versions.node.split('.').map(Number)
if (nodeVersion[0] < 16 || (nodeVersion[0] === 16 && nodeVersion[1] < 18)) {
safeRealpathSync = fs.realpathSync
return
}

exec('net use', (error, stdout) => {
if (error) return
const lines = stdout.split('\n')
Expand Down