WARNING in Duplicated path in loadChildren detected during a rebuild
See original GitHub issueVersions
Angular CLI: 1.5.0
Node: 8.9.1
OS: win32 x64
Angular: 5.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.38
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.8
typescript: 2.4.2
webpack: 3.8.1
Repro steps
- Checkout the project : https://github.com/arnaudoisel/lazy-loading-routes-bug
- > yarn (or npm install)
- > ng serve
- Modify the “routes.ts” file (by adding a comment for example)
- Save the file => The warning will be displayed in the console
Observed behavior
With Angular CLI, if a project contains a module that is lazy loaded, when we modify the file containing the routes, after the automatic rebuild by Angular CLI, the following warning message is displayed in the console :
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.
Desired behavior
Desired : No warning message displayed in console.
Otherwise it might cause bugs while developping. And even without any real issue, the warning message is a bit scary and could prevent from acknowledging real bugs in the application.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:28
- Comments:27 (2 by maintainers)
Top Results From Across the Web
"WARNING in Duplicated path in loadChildren detected ...
WARNING in Duplicated path in loadChildren detected during a rebuild. We will take the latest version detected and override it to save ...
Read more >Routing duplicate (Duplicated path in loadChildren detected)
Hi Maxine,. If it's the same route, you can't have it point to different components. The router doesn't know what to pick ...
Read more >关于angular路由配置的问题 - SegmentFault
WARNING in Duplicated path in loadChildren detected during a rebuild. We will take the latest version detected and override it to save ...
Read more >@angular/compiler-cli | Yarn - Package Manager
4962a4a332, feat, Allow loadChildren to return a Route array (#45700) ... 626f3f230b, perf, reduce analysis work during incremental rebuilds (#44731).
Read more >How To implement Lazy Loading in Angular
I have a question for a line in above snippet. What does the below line do? loadChildren: "../app/posts/posts.module#PostsModule".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
About the error: “WARNING in Duplicated path in loadChildren detected during a rebuild”… I managed to fix this by adding the full path to the loadChildren string.
I changed the string
'./orders/orders.module#OrdersModule'
to'app/orders/orders.module#OrdersModule'
.Now the error has gone, I think that this occurs because of the atribute string having the same ‘initial’ path of the loadChildren…
Before (with error):
{ path: 'orders', loadChildren: './orders/orders.module#OrdersModule'}
Now:{ path: 'orders', loadChildren: 'app/orders/orders.module#OrdersModule'}
I also get a lot of yellow warnings but I think I found my issue.
In my layout routes:
If I add a , after the last one like this
{ path: 'threed', loadChildren: './threed/threed.module#ThreedModule'},
then it will dump several lines of yellow saying duplicates just like @istiti.Make sure you stop ng serve and start it again. Once the yellow is there it will still show if you make the change without stopping ng serve.