diff --git a/packages/vite/plugins/nx-tsconfig-paths.plugin.ts b/packages/vite/plugins/nx-tsconfig-paths.plugin.ts index 2bf2fe3a16f46..cee82887dc039 100644 --- a/packages/vite/plugins/nx-tsconfig-paths.plugin.ts +++ b/packages/vite/plugins/nx-tsconfig-paths.plugin.ts @@ -66,6 +66,9 @@ export function nxViteTsPaths(options: nxViteTsPathsOptions = {}) { return { name: 'nx-vite-ts-paths', + // Ensure the resolveId aspect of the plugin is called before vite's internal resolver + // Otherwise, issues can arise with Yarn Workspaces and Pnpm Workspaces + enforce: 'pre', async configResolved(config: any) { projectRoot = config.root; const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);