diff --git a/packages/vite/src/node/optimizer/esbuildDepPlugin.ts b/packages/vite/src/node/optimizer/esbuildDepPlugin.ts index 54732be1b4e79b..4938cb5ebb5f0f 100644 --- a/packages/vite/src/node/optimizer/esbuildDepPlugin.ts +++ b/packages/vite/src/node/optimizer/esbuildDepPlugin.ts @@ -157,7 +157,10 @@ export function esbuildDepPlugin( if ( !relativePath.startsWith('./') && !relativePath.startsWith('../') && - relativePath !== '.' + relativePath !== '.' && + // Windows: when root and entryFile are on different drives, then + // getting relative path is not possible. + !path.isAbsolute(relativePath) ) { relativePath = `./${relativePath}` }