Skip to content

ng generate application produces wrong import path for AppRoutingModule (uses ./app-routing-module instead of ./app-routing.module) #30497

Closed
@brettaio

Description

@brettaio

Which @angular/* package(s) are the source of the bug?

compiler-cli

Is this a regression?

Yes

Description

I am running a monorepo of websites/applications

When running:

ng generate application application-name \
  --experimental-zoneless=true \
  --inline-style=true \
  --inline-template=true \
  --minimal=true \
  --ssr=true \
  --standalone=false \
  --strict=true \
  --style=css

the import within the app-module.ts for AppRoutingModule is:
import { AppRoutingModule } from './app-routing-module';

and not: 
import { AppRoutingModule } from './app-routing.module';

Found in version 20.0.0, updated to 20.0.2 and still present. 

### Please provide a link to a minimal reproduction of the bug

_No response_

### Please provide the exception or error you saw

```true

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.0.1
Node: 22.16.0
Package Manager: npm 10.9.2
OS: linux x64

Angular: 20.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2000.1
@angular-devkit/core         20.0.1
@angular-devkit/schematics   20.0.1
@angular/build               20.0.1
@angular/cli                 20.0.1
@angular/ssr                 20.0.1
@schematics/angular          20.0.1
ng-packagr                   20.0.0
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions