From 5503198d6a45db8b56357dc5466556a0288d81cb Mon Sep 17 00:00:00 2001 From: fi3ework Date: Wed, 7 Jun 2023 03:29:35 +0800 Subject: [PATCH] fix: remove extra path shorten when resolving from a dir (#13381) --- packages/vite/src/node/optimizer/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 5947305115c548..e476f61d5eef13 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -892,7 +892,12 @@ function createOptimizeDepsIncludeResolver( config.root, config.resolve.preserveSymlinks, ) - return await resolve(nestedPath, basedir, undefined, ssr) + return await resolve( + nestedPath, + path.resolve(basedir, 'package.json'), + undefined, + ssr, + ) } }