From eb1e2cded5941596b22fcabe63901f35bcc26b63 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Tue, 5 Nov 2024 10:46:18 +0000 Subject: [PATCH] fix(nuxt): use loadNuxtConfig to load nuxt config for plugin --- packages/nuxt/src/plugins/plugin.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/nuxt/src/plugins/plugin.ts b/packages/nuxt/src/plugins/plugin.ts index 3fb80e9b3455cb..827d737f378d4e 100644 --- a/packages/nuxt/src/plugins/plugin.ts +++ b/packages/nuxt/src/plugins/plugin.ts @@ -14,7 +14,7 @@ import { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs'; import { existsSync, readdirSync } from 'fs'; import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash-for-create-nodes'; import { getLockFileName } from '@nx/js'; -import { loadConfigFile } from '@nx/devkit/src/utils/config-utils'; +import { loadNuxtKitDynamicImport } from '../utils/executor-utils'; const cachePath = join(workspaceDataDirectory, 'nuxt.hash'); const targetsCache = readTargetsCache(); @@ -208,10 +208,11 @@ async function getInfoFromNuxtConfig( ): Promise<{ buildDir: string; }> { - // TODO(Colum): Once plugins are isolated we can go back to @nuxt/kit since each plugin will be run in its own worker. - const config = await loadConfigFile( - join(context.workspaceRoot, configFilePath) - ); + const config = await ( + await loadNuxtKitDynamicImport() + ).loadNuxtConfig({ + configFile: configFilePath, + }); return { buildDir: config?.buildDir ??