Skip to content

Conversation

@SkyZeroZx
Copy link
Contributor

@SkyZeroZx SkyZeroZx commented Oct 1, 2025

… standalone migration

This fix preserves component imports by adding missing statements and replacing module references with the correct component

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #63945

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Should we consider the case where a module and component are defined in the same file as an edge case that doesn’t justify adding extra complexity to the migration logic, or is it worth handling automatically to avoid requiring manual cleanup?

… standalone migration

This fix preserves component imports by adding missing  statements and replacing module references with the correct component
@pullapprove pullapprove bot requested a review from AndrewKushnir October 1, 2025 21:30
@angular-robot angular-robot bot added the area: migrations Issues related to `ng update`/`ng generate` migrations label Oct 1, 2025
@ngbot ngbot bot added this to the Backlog milestone Oct 1, 2025
@AndrewKushnir AndrewKushnir requested review from crisbeto and removed request for AndrewKushnir October 1, 2025 22:04
@mattlewis92
Copy link
Contributor

@SkyZeroZx thank you for taking this on! I just tried patching this into our version of angular and it doesn't fix the problem we were facing, of the schematic removing NgModule imports without replacing it with the standalone component import, so I'm not sure the test cases I provided accurately capture the bug we were facing. As this introduces a lot of extra code for a non real issue, it's probably best to close this for now until I can create a more accurate reproduction of the issue we have.

@SkyZeroZx
Copy link
Contributor Author

SkyZeroZx commented Oct 2, 2025

That's strange. I have some small, similar test cases that you provided in a repository for testing, and they worked for me.

However, there is one case where if the component and module are in the same file, they won't migrate correctly.

@mmalerba mmalerba added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Oct 2, 2025
@mmalerba
Copy link
Contributor

mmalerba commented Oct 2, 2025

This PR was merged into the repository. The changes were merged into the following branches:

@mmalerba mmalerba closed this in d3e76b1 Oct 2, 2025
mmalerba pushed a commit that referenced this pull request Oct 2, 2025
… standalone migration (#64186)

This fix preserves component imports by adding missing  statements and replacing module references with the correct component

PR Close #64186
napulitanfrontend pushed a commit to napulitanfrontend/angular that referenced this pull request Oct 10, 2025
… standalone migration (angular#64186)

This fix preserves component imports by adding missing  statements and replacing module references with the correct component

PR Close angular#64186
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: migrations Issues related to `ng update`/`ng generate` migrations target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants