From b91e26eef364a09f2fd1b7e6797a7e1f279f020b Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Mon, 24 Jun 2024 13:33:12 -0700 Subject: [PATCH] fix(bundling): use vite createNodes v2 for add plugin (#26662) ## Current Behavior vite createNodesV1 is used during init ## Expected Behavior vite createNodesV2 is used during init ## Related Issue(s) Fixes # (cherry picked from commit a3322f76efbd1aa7b0c5b70ca5b1e5b0239f2164) --- packages/vite/src/generators/init/init.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/generators/init/init.ts b/packages/vite/src/generators/init/init.ts index ee3f2ee709f1c..6a5018ec96364 100644 --- a/packages/vite/src/generators/init/init.ts +++ b/packages/vite/src/generators/init/init.ts @@ -7,10 +7,10 @@ import { Tree, updateNxJson, } from '@nx/devkit'; -import { addPluginV1 } from '@nx/devkit/src/utils/add-plugin'; +import { addPlugin } from '@nx/devkit/src/utils/add-plugin'; import { setupPathsPlugin } from '../setup-paths-plugin/setup-paths-plugin'; -import { createNodes } from '../../plugins/plugin'; +import { createNodesV2 } from '../../plugins/plugin'; import { InitGeneratorSchema } from './schema'; import { checkDependenciesInstalled, moveToDevDependencies } from './lib/utils'; @@ -61,11 +61,11 @@ export async function initGeneratorInternal( schema.addPlugin ??= addPluginDefault; if (schema.addPlugin) { - await addPluginV1( + await addPlugin( tree, await createProjectGraphAsync(), '@nx/vite/plugin', - createNodes, + createNodesV2, { buildTargetName: ['build', 'vite:build', 'vite-build'], testTargetName: ['test', 'vite:test', 'vite-test'],