-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Assignees
@chrisguttandin
Please provide the environment you discovered this bug in (run
Description
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
Please consider the following set of routes:
// app.routes.ts import { Routes } from '@angular/router'; import { One } from './one/one'; import { Two } from './two/two'; export const routes: Routes = [ { children: [ { component: Two, path: 'two' }, { path: '', redirectTo: 'two' } ], component: One, path: 'one' }, { path: '', redirectTo: 'one' } ];
When setting the outputMode
to 'static'
I would expect this to produce the following pre-rendered HTML files.
- /index.html (with a redirect to /one)
- /one/index.html (with a redirect to /one/two)
- /one/two/index.html (with a pre-rendered page)
This works a expected.
It breaks when splitting the routes in two separate files.
// children.routes.ts import { Routes } from '@angular/router'; import { One } from './one/one'; import { Two } from './two/two'; export const routes: Routes = [ { children: [ { component: Two, path: 'two' }, { path: '', redirectTo: 'two' } ], component: One, path: '' } ]; export { routes as default };
// app.routes.ts import { Routes } from '@angular/router'; export const routes: Routes = [ { loadChildren: () => import('./children.routes'), path: 'one' }, { path: '', redirectTo: 'one' } ];
Please provide a link to a minimal reproduction of the bug
https://github.com/chrisguttandin/example
Please provide the exception or error you saw
One of the redirects is now missing. There will be an empty file instead.
- /index.html (with a redirect to /one)
- /one/index.html (**is an empty file**)
- /one/two/index.html (with a pre-rendered page)
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 20.2.1
Node: 22.17.1
Package Manager: npm 8.19.3
OS: darwin arm64
Angular: 20.2.2
... animations, common, compiler, compiler-cli, core
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker
Package Version
---------------------------------------
@angular-devkit/architect 0.2002.1
@angular-devkit/build-angular 20.2.1
@angular-devkit/core 20.2.1
@angular-devkit/schematics 20.2.1
@angular/cli 20.2.1
@angular/ssr 20.2.1
@schematics/angular 20.2.1
rxjs 7.8.2
typescript 5.8.3
zone.js 0.15.1
Anything else?
No response