Skip to content

Migration to lazy-loaded routes not working if Routes are exported as default #58861

@wfvs

Description

@wfvs

Command

generate

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

this is a new migration schematic

Description

using the new migration schematic
ng generate @angular/core:route-lazy-loading
results in 'Could not find any files to migrate under the path ...'
The Routes are exported as default, which causes the schematic to fail finding them.

Minimal Reproduction

trying to migrate the following route.ts file:

export default [
    {
        path: '',
        component: SomeComponent,
        children: [
          { path: 'index', component: IndexComponent },
          { path: 'index/:name', component: IndexDetailComponent, resolve: { index: indexDetailResolver } }
        ]
      }
] as Routes; 

using:
ng generate @angular/core:route-lazy-loading --path src/app/something

fails, because the migration schematic does not recognize the Routes, which are exported as default.

Exception or Error


Your Environment

"@angular/cli": "^19.0.1"

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: migrationsIssues related to `ng update`/`ng generate` migrationsopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions