Skip to content

Commit

Permalink
fix(react): change application generation steps sequence
Browse files Browse the repository at this point in the history
Closes #29234
  • Loading branch information
pawel-twardziak committed Dec 6, 2024
1 parent de8b189 commit 9ca6353
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/react/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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,
Expand All @@ -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')
Expand Down

0 comments on commit 9ca6353

Please sign in to comment.