question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Lazy loaded routes are not documented

See original GitHub issue
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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:19

github_iconTop GitHub Comments

8reactions
headonkeyboardcommented, Oct 15, 2020

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

6reactions
ru-van-urkcommented, Jun 30, 2021

The issue still exists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Route - Angular
A configuration object that defines a single route. A set of routes are collected in a Routes array to define a Router configuration....
Read more >
multiple routes are not working in angular 10 lazy loaded ...
I want to have multiple routes there on the productModule but it is not working. Can anyone help? I have tried cannot find...
Read more >
Resolving errors faced while implementing Lazy Loading with ...
It is a known bug in Angular that lazy loading module does not work well with Auxiliary routes / named router. For a...
Read more >
Code-Splitting - React
Code-splitting your app can help you “lazy-load” just the things that are ... that Babel can parse the dynamic import syntax but is...
Read more >
Lazy load Angular Components | juri.dev
For the routing, the Angular CLI makes sure to create that bundle whenever it sees a loadChildren and according path. For our own...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found