You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ng generate application produces wrong import path for AppRoutingModule (uses ./app-routing-module instead of ./app-routing.module) #30497
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)
I’m unable to reproduce this issue. It's surprising, considering that the --experimental-zoneless option is no longer available in version 20, and running ng generate application with it should result in a failure.
Activity
dev-bretta commentedon Jun 9, 2025
On top of this, I have just realised that there are two app-modules.
One app-module.ts that contains:
`import { NgModule, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core';
import { BrowserModule, provideClientHydration, withEventReplay } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing-module';
import { App } from './app';
@NgModule({
declarations: [
App
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [
provideBrowserGlobalErrorListeners(),
provideZonelessChangeDetection(),
provideClientHydration(withEventReplay())
],
bootstrap: [App]
})
export class AppModule { }
`
and a second properly formatted path app.module.ts that contains:
`import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
@NgModule({
declarations: [],
imports: [,
AppRoutingModule
]
})
export class AppModule { }
alan-agius4 commentedon Jun 10, 2025
I’m unable to reproduce this issue. It's surprising, considering that the
--experimental-zonelessoption is no longer available in version 20, and runningng generate applicationwith it should result in a failure.Could you run the following command and share the output?
dev-bretta commentedon Jun 10, 2025
My apologies I used --zoneless=false
alan-agius4 commentedon Jun 10, 2025
I am not seeing an
app.module.tsbeing created. Can you please share the output ofnpm ls @schematics/angular?dev-bretta commentedon Jun 10, 2025
@angular/[email protected]
└── @schematics/[email protected]
dev-bretta commentedon Jun 10, 2025
Console Output:
dev-bretta commentedon Jun 10, 2025
workspace setup command is:
This was run in version 19
alan-agius4 commentedon Jun 10, 2025
@brettaio, I was able to replicate the issue when generating the workspace using Angular CLI version 19.
dev-bretta commentedon Jun 10, 2025
I've cleared node_modules and install with the current setup - same bug
fix(@schematics/angular): reset module `typeSeparator` when generatin…
fix(@schematics/angular): reset module `typeSeparator` when generatin…
fix(@schematics/angular): reset module `typeSeparator` when generatin…
dev-bretta commentedon Jun 17, 2025
Have update to latest and still having same issue
dev-bretta commentedon Jun 17, 2025
Angular CLI: 20.0.2
Node: 22.16.0
Package Manager: npm 10.9.2
OS: linux x64
Angular: 20.0.3
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
@angular-devkit/architect 0.2000.2
@angular-devkit/core 20.0.2
@angular-devkit/schematics 20.0.2
@angular/build 20.0.2
@angular/cli 20.0.2
@angular/ssr 20.0.2
@schematics/angular 20.0.2
ng-packagr 20.0.0
rxjs 7.8.2
typescript 5.8.3
zone.js 0.15.1
alan-agius4 commentedon Jun 17, 2025
This is not released yet. It will be on NPM later this week.
angular-automatic-lock-bot commentedon Jul 18, 2025
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.