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, + ) } }