Do NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
In this line, the ctx.path may be a direcory.
https://github.com/vuejs/vite/blob/6683bb8fb819c6f4935b40f25c2a377037e5ec7d/src/node/server/serverPluginModuleRewrite.ts#L129
But when you resolve relative import, you treat it as a file path.
https://github.com/vuejs/vite/blob/49a44b648f263ff058f730913ea1ee6c62e3cd2d/src/node/utils/pathUtils.ts#L16
For example, if /dir/index.js have import './utils', and browser request for /dir, vite will try to find utils from /utils instead of /dir/utils
Describe the bug
In this line, the
ctx.pathmay be a direcory.https://github.com/vuejs/vite/blob/6683bb8fb819c6f4935b40f25c2a377037e5ec7d/src/node/server/serverPluginModuleRewrite.ts#L129
But when you resolve relative import, you treat it as a file path.
https://github.com/vuejs/vite/blob/49a44b648f263ff058f730913ea1ee6c62e3cd2d/src/node/utils/pathUtils.ts#L16
For example, if
/dir/index.jshaveimport './utils', and browser request for/dir, vite will try to find utils from/utilsinstead of/dir/utils