compodoc: [BUG] Lazy loaded routes are not documented

Overview of the issue

Lazy Loaded routes are not showing in documentation:

image

Operating System, Node.js, npm, compodoc version(s)

OS: Windows Node: 12.8.0 npm: 6.10.2 Angular CLI: 9.1.0

Compodoc installed globally or locally ?

Tried both

If possible sourcecode of the file where it breaks

Here is part of my app-routing.module.ts

// src/app/app-routing.module.ts
const routes: Routes = [
  {
    path: 'module1',
    loadChildren: () =>
      import('./modules/module1/module1.module').then((m) => m.Module1Module),
  }
]

And for each module, such as Module1:

// src/app/modules/module1/module1-routing.module.ts
const routes: Routes = [
  {
    path: '',
    component: Module1Component,
    data: {
      ...
    },
    canActivate: [AuthGuard],
    children: [
      {
        path: '',
        redirectTo: 'list'
      },
      {
        path: 'list',
        pathMatch: 'full',
        component: ListComponent,
        data: {
          ...
        },
      },
      {
        path: ':id',
        component: DetailsComponent,
        data: {
          ...
        },
      },
    ],
  },
];
If possible your terminal logs before the error
Error during generation of routes JSON file, maybe a trailing comma or an external variable inside one route.

image

Motivation for or Use Case

It should document all routes in the corresponding section.

Reproduce the error
  • Create a new app using the CLI and adding --routing
  • Create a new module (ng g m module --routing)
  • Add some routes an sample components as previously specified.
  • Try to create the documentation (npx compodoc -p tsconfig.json)
Related issues

Several times, but all of them have been closed due to inactivity #690, #569, #609, #805, #819.

Suggest a Fix

I haven’t found a solution yet.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 24

Commits related to this issue

Most upvoted comments

Hi, I’ve just found a workaround that works for me on compodoc 1.1.11. Just replace

(m) => m.MyModule

by

m => m.MyModule

I think the regex need some improvement here : https://github.com/compodoc/compodoc/blob/8c509f0c130fb7cfc63f470a16e2fce73ddca092/src/utils/router-parser.util.ts#L25

The issue still exists.

I was always using the global package, still it did not work.

But I can confirm the workaround posted by @headonkeyboard

Hi there. I getting the same issue and what i see.

TL;DR; globally installed compodoc, seems works well (for me)

🔴 compodoc(version 0.0.41) installed as devDependency

image

npm run compodoc

image

🟢 compodoc(v0.0.41) installed as GLOBAL package (“npm install -g compodoc”)

All works without router parsing errors !!! and documentation looks good

compodoc -p tsconfig.json src 

image

So it seems some shared local dependency or special working mode of compodoc as devDependency adds side effect

getting this error as well on angular 10.1.1 and compodoc 1.1.11

is there any progress on this?

I offer myself to work on this, but I am available starting next week.

Still an issue bump thread Angular 15.2.0 Compodoc 1.1.19

The issue still exists.

Angular 15.2.0 Compodoc 1.1.19