Skip to content

modulepreload links show href="[object Object]" with loadComponent during SSR/CSR transition #30624

Closed as not planned
@askeric

Description

@askeric

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

router

Is this a regression?

Unknown

Description

Repro:
Put this in your route in an SSR/CSR app (note the loadComponent),

  {
    path: 'ssr-test',
    loadComponent: () =>
       import('src/app/ssr-test/ssr-test').then(
        (c) => c.SsrTestComponent
      ),
    resolve: { diveSites: divesiteResolver }, 
    data: { prerender: false }
  },

In ServerRoute, put this

  {
    path: 'ssr-test',
    renderMode: RenderMode.Server  
  },

Go visit the route and you'll see an error downloading resource "[object Object]" as the page transitions from SSR to CSR.

You can see this at the bottom of the page when doing a view source:
<link rel="modulepreload" href="[object Object]">

If I switch from loadComponent to component in my route, the issue goes away

{
    path: 'ssr-test',
    component: SsrTestComponent,
    resolve: { diveSites: divesiteResolver },
    data: { prerender: false }
  },

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


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

Angular CLI: 20.0.2
Node: 22.14.0
Package Manager: npm 10.9.2
OS: win32 x64

Angular: 20.0.3
... animations, cdk, common, compiler, compiler-cli, core, forms
... google-maps, material, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.2000.2
@angular-devkit/build-angular   20.0.2
@angular-devkit/core            20.0.2
@angular-devkit/schematics      20.0.2
@angular/cli                    20.0.2
@angular/fire                   20.0.1
@angular/ssr                    20.0.4
@schematics/angular             20.0.2
rxjs                            7.8.2
typescript                      5.8.3
zone.js                         0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions