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.

Error: Multiple root routing modules found

See original GitHub issue

I’m still getting an error while adding lazy loaded routes to my Angular project. According to #87 and #82 the error should be fixed, but it isn’t.

Error:

UnhandledPromiseRejectionWarning: Error: Multiple root routing modules found C:\Users\Toni\Source\test\universe\src\app\lazy\lazy-routing.module.ts, C:\Users\Toni\Source\test\universe\src\app\app-routing.module.ts
    at findRootModule (C:\Users\Toni\Source\test\universe\node_modules\guess-parser\dist\guess-parser\index.js:419:15)
    at exports.parseRoutes (C:\Users\Toni\Source\test\universe\node_modules\guess-parser\dist\guess-parser\index.js:582:31)
    at prerender (C:\Users\Toni\Source\test\universe\node_modules\angular-prerender\build\node\functions\prerender.js:89:54)

I’m using the following commands to create the project:

ng new universe --routing
cd universe
ng generate universal --client-project universe
ng generate module lazy --route lazy --module app
ng build
ng run universe:server
npx angular-prerender

My environment is:

  • Angular CLI: 8.3.14
  • Node: 12.12.0
  • OS: win32 x64
  • Angular: 8.2.12

And the version of angular-prerender that is being used is 4.1.21.

Is there a workaround or different syntax for adding lazy loaded routes/modules to the project? Are lazy loaded routes actually supported?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tonivrbiccommented, Oct 29, 2019

I’ve tested it and it works! 🔥

0reactions
chrisguttandincommented, Oct 29, 2019

Hi @tonivrbic, can you please give v4.1.22 a try? I contains the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple root routing modules found · Issue #265 · scullyio/scully
This means that the root of your application will be you normal angular app, and is not rendered by Scully In some circumstances...
Read more >
Routes not found in angular routing with multiple child modules
I have a parent module and a number of child modules. Parent module routing works but none of the child routes work: Error:...
Read more >
scullyio/community - Gitter
@SanderElias now I get Error: Multiple root routing modules. Preston Lamb. @pjlamb12 ... A complete log of this run can be found in:...
Read more >
Add navigation with routing - Angular
First, the app-routing.module.ts file imports RouterModule and Routes so the application can have routing capability. The next import, HeroesComponent , gives ...
Read more >
Routing - Remix
Because a Route module maps to only a segment of the URL, multiple routes can be ... We've found that in almost every...
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