diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index c632aa3b484912..4c9ac2702bb128 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -476,12 +476,12 @@ function tryFsResolve( // Dependencies like es5-ext use `#` in their paths. We don't support `#` in user // source code so we only need to perform the check for dependencies. - const trySharp = fsPath.includes('#') && fsPath.includes('node_modules') + const tryUnsplitted = fsPath.includes('#') && fsPath.includes('node_modules') let res: string | undefined if ( - trySharp && + tryUnsplitted && (res = tryResolveFile( fsPath, '', @@ -511,7 +511,7 @@ function tryFsResolve( for (const ext of options.extensions) { if ( - trySharp && + tryUnsplitted && (res = tryResolveFile( fsPath + ext, '', @@ -546,7 +546,7 @@ function tryFsResolve( if (!tryIndex) return if ( - trySharp && + tryUnsplitted && (res = tryResolveFile( fsPath, '',