tomwhite007/rename-angular-component

Rename project root, app component can break app.routes

Opened this issue · 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.

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.