Skip to content

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

Closed

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

Activity

  1. added
    area: migrations
    on Nov 24, 2024
  2. added this to the needsTriage milestone on Nov 24, 2024
  3. added
    open for contributions
    on Sep 15, 2025
  4. angular-automatic-lock-bot commented on Oct 20, 2025

    @angular-automatic-lock-bot

    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.

  5. locked and limited conversation to collaborators on Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: migrationsopen for contributions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions