Skip to content

Commit

Permalink
fix(vite): Storing nxjson details too early (#22285)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed Mar 12, 2024
1 parent 9ca400c commit b6cd196
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/vite/src/generators/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ export async function viteConfigurationGeneratorInternal(
) {
const tasks: GeneratorCallback[] = [];

const nxJson = readNxJson(tree);
const addPluginDefault =
process.env.NX_ADD_PLUGINS !== 'false' &&
nxJson.useInferencePlugins !== false;
schema.addPlugin ??= addPluginDefault;

const projectConfig = readProjectConfiguration(tree, schema.project);
const { targets, root: projectRoot } = projectConfig;

Expand Down Expand Up @@ -77,6 +71,12 @@ export async function viteConfigurationGeneratorInternal(
tasks.push(initTask);
tasks.push(ensureDependencies(tree, schema));

const nxJson = readNxJson(tree);
const addPluginDefault =
process.env.NX_ADD_PLUGINS !== 'false' &&
nxJson.useInferencePlugins !== false;
schema.addPlugin ??= addPluginDefault;

const hasPlugin = nxJson.plugins?.some((p) =>
typeof p === 'string'
? p === '@nx/vite/plugin'
Expand Down

0 comments on commit b6cd196

Please sign in to comment.