diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index 7a85aa84b24426..92965078e9e816 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -20,7 +20,6 @@ import { cleanUrl, createDebugger, deepImportRE, - ensureVolumeInPath, fsPathFromId, injectQuery, isBuiltin, @@ -203,7 +202,7 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin { if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) { const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) - : normalizePath(ensureVolumeInPath(path.resolve(root, id.slice(1)))) + : normalizePath(path.resolve(root, id.slice(1))) return optimizedPath } @@ -1250,7 +1249,6 @@ function equalWithoutSuffix(path: string, key: string, suffix: string) { } function getRealPath(resolved: string, preserveSymlinks?: boolean): string { - resolved = ensureVolumeInPath(resolved) if (!preserveSymlinks && browserExternalId !== resolved) { resolved = safeRealpathSync(resolved) } diff --git a/packages/vite/src/node/server/middlewares/transform.ts b/packages/vite/src/node/server/middlewares/transform.ts index 8fb184181c417d..b149c8e89fe9eb 100644 --- a/packages/vite/src/node/server/middlewares/transform.ts +++ b/packages/vite/src/node/server/middlewares/transform.ts @@ -7,7 +7,6 @@ import type { ViteDevServer } from '..' import { cleanUrl, createDebugger, - ensureVolumeInPath, fsPathFromId, injectQuery, isImportRequest, @@ -79,9 +78,7 @@ export function transformMiddleware( // means that the dependency has already been pre-bundled and loaded const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) - : normalizePath( - ensureVolumeInPath(path.resolve(root, url.slice(1))), - ) + : normalizePath(path.resolve(root, url.slice(1))) try { const map = JSON.parse( await fsp.readFile(sourcemapPath, 'utf-8'), diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 68f26d95cf18cc..3f52cda0e53565 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -255,10 +255,6 @@ export function isParentDirectory(dir: string, file: string): boolean { ) } -export function ensureVolumeInPath(file: string): string { - return isWindows ? path.resolve(file) : file -} - export const queryRE = /\?.*$/s const postfixRE = /[?#].*$/s