Skip to content

Commit

Permalink
fix(bundling): use vite createNodes v2 for add plugin (#26662)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

vite createNodesV1 is used during init

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

vite createNodesV2 is used during init

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

(cherry picked from commit a3322f7)
  • Loading branch information
FrozenPandaz committed Jun 26, 2024
1 parent 38da368 commit b91e26e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vite/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit b91e26e

Please sign in to comment.