rename-angular-component icon indicating copy to clipboard operation
rename-angular-component copied to clipboard

Rename project root, app component can break app.routes

Open tomwhite007 opened this issue 3 months ago • 1 comments

Describe the bug Depending on the app.routes configuration (i.e. some apps, not others), the route paths get rewritten incorrectly. See example below:

Image

To Reproduce Right click the src/app/app.component.ts or src/app/app.ts (in an Angular 20 generated project), Rename the component to any new name, Open the app.routes file and check the diff.

Expected behavior Should not need to rename paths because the container folder has changed, not the local path.

Additional context I've discovered this problem was present in version 3.x as well. It looks partly related to needing to rename backwards from the bottom of the file. But the fact is, it shouldn't be renamed because the paths are local.

tomwhite007 avatar Sep 09 '25 08:09 tomwhite007

As this issue was present in version 3.x, and most devs will never want to rename the app component, I'm happy to postpone this issue until after the version 4.0.0 release.

tomwhite007 avatar Sep 09 '25 08:09 tomwhite007