Skip to content

fix(angular): keep extra target metadata when needed in convert-to-rspack generator #31309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leosvelperez
Copy link
Member

Current Behavior

When converting an Angular project to use Rspack with the @nx/angular:convert-to-rspack generator, some target top-level options can be lost (e.g. custom dependsOn, outputs, etc.).

Expected Behavior

When converting an Angular project to use Rspack with the @nx/angular:convert-to-rspack generator, relevant target top-level options that wouldn't be inferred need to be kept in the converted project.

Related Issue(s)

Fixes #

@leosvelperez leosvelperez self-assigned this May 22, 2025
@leosvelperez leosvelperez requested a review from a team as a code owner May 22, 2025 15:05
@leosvelperez leosvelperez requested a review from Coly010 May 22, 2025 15:05
Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview May 27, 2025 7:40am

Copy link

nx-cloud bot commented May 22, 2025

View your CI Pipeline Execution ↗ for commit 543c117.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 27m 21s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 4s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 3s View ↗
nx documentation ✅ Succeeded 2m 24s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-27 08:15:06 UTC

@leosvelperez leosvelperez requested a review from Copilot May 22, 2025 15:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes conversion issues when migrating Angular projects to Rspack by preserving extra target metadata such as custom dependsOn, outputs, and other options that would otherwise be lost. Key changes include reordering and adding new imports, consolidating target removal into a single targetsToRemove array, and enhancing the logic to selectively override or preserve build and serve target configurations.

Comments suppressed due to low confidence (1)

packages/angular/src/generators/convert-to-rspack/convert-to-rspack.ts:541

  • [nitpick] The logic for overriding target inputs appears duplicated with similar patterns later in the file; extracting this into a helper function might improve readability and reduce potential maintenance issues.
buildTarget.config.inputs = [ ...buildTarget.config.inputs, { externalDependencies: ['@rspack/cli'] } ];

@leosvelperez leosvelperez force-pushed the angular/fix-convert-to-rspack-target-metadata branch from ab09549 to ea86e19 Compare May 23, 2025 12:14
@leosvelperez leosvelperez force-pushed the angular/fix-convert-to-rspack-target-metadata branch from ea86e19 to 543c117 Compare May 27, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant