diff --git a/packages/vite/plugins/nx-tsconfig-paths.plugin.ts b/packages/vite/plugins/nx-tsconfig-paths.plugin.ts index 5bb5e7ea84..5c21bae0ca 100644 --- a/packages/vite/plugins/nx-tsconfig-paths.plugin.ts +++ b/packages/vite/plugins/nx-tsconfig-paths.plugin.ts @@ -171,7 +171,7 @@ There should at least be a tsconfig.base.json or tsconfig.json in the root of th resolvedFile = matchTsPathFallback?.(importPath); } - if (!resolvedFile) { + if (!resolvedFile || !existsSync(resolvedFile)) { if (tsConfigPathsEsm || tsConfigPathsFallback) { logIt( `Unable to resolve ${importPath} with tsconfig paths. Using fallback file matching.`