diff --git a/packages/react/src/generators/application/application.ts b/packages/react/src/generators/application/application.ts index c9a421896e46a0..a722f89f385498 100644 --- a/packages/react/src/generators/application/application.ts +++ b/packages/react/src/generators/application/application.ts @@ -159,21 +159,11 @@ export async function applicationGeneratorInternal( ); tasks.push(ensureDependencies(host, { uiFramework: 'react' })); } - } else if (options.bundler === 'rspack') { - const { rspackInitGenerator } = ensurePackage('@nx/rspack', nxVersion); - const rspackInitTask = await rspackInitGenerator(host, { - ...options, - addPlugin: false, - skipFormat: true, - }); - tasks.push(rspackInitTask); } if (!options.rootProject) { extractTsConfigBase(host); } - - await createApplicationFiles(host, options); addProject(host, options); if (options.style === 'tailwind') { @@ -230,6 +220,9 @@ export async function applicationGeneratorInternal( false ); } else if (options.bundler === 'rspack') { + /** + * 'configurationGenerator' calls 'rspackInitGenerator' internally + */ const { configurationGenerator } = ensurePackage('@nx/rspack', nxVersion); const rspackTask = await configurationGenerator(host, { project: options.projectName, @@ -251,6 +244,11 @@ export async function applicationGeneratorInternal( tasks.push(rspackTask); } + /** + * Generate app files once both the project and the base configuration are there + */ + await createApplicationFiles(host, options); + if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') { const { createOrEditViteConfig, vitestGenerator } = ensurePackage< typeof import('@nx/vite')