From 7150e067e1dda8b6b22ac4245bf8ba35ca29a844 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Mon, 17 Jun 2024 11:02:45 +0100 Subject: [PATCH] fix(vite): nxViteTsPaths plugin should not run-many for vitest --- packages/vite/plugins/nx-tsconfig-paths.plugin.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vite/plugins/nx-tsconfig-paths.plugin.ts b/packages/vite/plugins/nx-tsconfig-paths.plugin.ts index 040de1dc7a273..adb51b8f33b8c 100644 --- a/packages/vite/plugins/nx-tsconfig-paths.plugin.ts +++ b/packages/vite/plugins/nx-tsconfig-paths.plugin.ts @@ -83,7 +83,11 @@ export function nxViteTsPaths(options: nxViteTsPathsOptions = {}) { There should at least be a tsconfig.base.json or tsconfig.json in the root of the workspace ${workspaceRoot}`); } - if (!options.buildLibsFromSource && !global.NX_GRAPH_CREATION) { + if ( + !options.buildLibsFromSource && + !global.NX_GRAPH_CREATION && + config.mode !== 'test' + ) { const projectGraph = await createProjectGraphAsync({ exitOnError: false, resetDaemonClient: true, @@ -123,7 +127,7 @@ There should at least be a tsconfig.base.json or tsconfig.json in the root of th logIt('first parsed tsconfig: ', parsed); if (parsed.resultType === 'failed') { - throw new Error(`Failed loading tsonfig at ${foundTsConfigPath}`); + throw new Error(`Failed loading tsconfig at ${foundTsConfigPath}`); } tsConfigPathsEsm = parsed;