Skip to content

Commit

Permalink
fix(nuxt): use loadConfigFile from devkit rather than @nuxt/kit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Mar 28, 2024
1 parent 4b75255 commit 416854a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion e2e/nuxt/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"targets": {
"e2e": {}
},
"implicitDependencies": ["nuxt"]
"implicitDependencies": ["nuxt", "vite"]
}
18 changes: 9 additions & 9 deletions packages/nuxt/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { basename, dirname, isAbsolute, join, relative } from 'path';
import { projectGraphCacheDirectory } from 'nx/src/utils/cache-directory';
import { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs';
import { existsSync, readdirSync } from 'fs';
import { loadNuxtKitDynamicImport } from '../utils/executor-utils';
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';

const cachePath = join(projectGraphCacheDirectory, 'nuxt.hash');
const targetsCache = existsSync(cachePath) ? readTargetsCache() : {};
Expand Down Expand Up @@ -208,15 +208,15 @@ async function getInfoFromNuxtConfig(
): Promise<{
buildDir: string;
}> {
const { loadNuxtConfig } = await loadNuxtKitDynamicImport();

const config = await loadNuxtConfig({
cwd: joinPathFragments(context.workspaceRoot, projectRoot),
configFile: basename(configFilePath),
});

const config = await loadConfigFile(
join(context.workspaceRoot, configFilePath)
);
return {
buildDir: config?.buildDir,
buildDir:
config?.buildDir ??
// Match .nuxt default build dir from '@nuxt/schema'
// See: https://github.com/nuxt/nuxt/blob/871404ae5673425aeedde82f123ea58aa7c6facf/packages/schema/src/config/common.ts#L117-L119
'.nuxt',
};
}

Expand Down

0 comments on commit 416854a

Please sign in to comment.