"WARNING in Duplicated path in loadChildren Detected During a rebuild." duplicated paths

Asked

Viewed 527 times

0

What could be wrong to lead to warn?
WARNING in Duplicated path in loadChildren detected during a rebuild. We will take the latest version detected and override it to save rebuild time. You should perform a full build to validate that your routes don't overlap.

1 answer

1

There are some reasons I found for the warn. Was reported in Issue 8722 of angular-cli but I found one beyond these responses that adjusted.

  • lazyModules in angular.json
    this was the reason I spent a few days trying to adjust this warn. With Angular 6 there is a new property called lazyModules in "architect":{ "build":{ "options"{ "lazyModules":[] } } } In this property should be informed the modules that are not drawn on routes and that you would like them to be loaded in a lazy way. If you inform a module on this property and the same module on the routes, the warn. Cleaning this property has stopped taking place the warn for me.
  • duplicate routes
    within this angular-cli Issue has been pointed out that the path of the module may be duplicating the route of the angular cli, for this it is necessary to inform the path correctly on the route so that the cli understands the root route and not duplicate with the daughter routes. This warn was adjusted by the others with the adjustment of the property loadChildren as follows:
    Before (with error):
    { path: 'orders', loadChildren: './orders/orders.module#OrdersModule'}
    Now:
    { path: 'orders', loadChildren: 'app/orders/orders.module#OrdersModule'}
  • last route with a comma at the end
    yes, you did not read wrong kk, by the tests I did here it did not occur to me using angular 6, but some users arurmaram the warn noted in the Issue 8722 just by adding a comma at the end of the last declared route.
    { path: 'threed', loadChildren: './threed/threed.module#ThreedModule'},

i also found on other sites that if a link is reported in the tsconfig.json file in the property "paths" could inform a loadChildren same for other routes, but not able to reproduce the warn doing that too.

With this question/ answer I hope that other users can solve this warn easier way. Hug

  • Anyone who wants to know more about the link in tsconfig.json is at this link user-answered moseleman

Browser other questions tagged

You are not signed in. Login or sign up in order to post.