Skip to content

Commit c49af23

Browse files
authored
perf(resolve): reduce vite client path checks (#12471)
1 parent 80c526e commit c49af23

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/vite/src/node/config.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
DEFAULT_EXTENSIONS,
4949
DEFAULT_MAIN_FIELDS,
5050
ENV_ENTRY,
51+
FS_PREFIX,
5152
} from './constants'
5253
import type {
5354
InternalResolveOptions,
@@ -475,8 +476,14 @@ export async function resolveConfig(
475476
)
476477

477478
const clientAlias = [
478-
{ find: /^\/?@vite\/env/, replacement: ENV_ENTRY },
479-
{ find: /^\/?@vite\/client/, replacement: CLIENT_ENTRY },
479+
{
480+
find: /^\/?@vite\/env/,
481+
replacement: path.posix.join(FS_PREFIX, normalizePath(ENV_ENTRY)),
482+
},
483+
{
484+
find: /^\/?@vite\/client/,
485+
replacement: path.posix.join(FS_PREFIX, normalizePath(CLIENT_ENTRY)),
486+
},
480487
]
481488

482489
// resolve alias with internal client alias

0 commit comments

Comments
 (0)