I am in the process of transferring a fairly large Angular 1.6 application from an old build system to Yarn/Webpack.
Our routing is based on ngRoute with a complex promise chain. While sorting out the imports and dependencies, I keep encountering this error:
WARNING: Tried to load angular more than once.
After reading this post on Stack Overflow, it seems that there could be several reasons for this issue. However, fixing the templateUrl paths has helped me resolve some problems with certain pages in the app. This includes both in module definitions and when using ng-include in any template.
The challenge lies in the fact that some component chains are very complex, with conditional ng-includes scattered throughout. It would be extremely helpful if, instead of manually searching through these extensive component trees, I could receive feedback at the end of the promise chain whenever there is a mismatch:
.otherwise({
redirectTo: '/',
template: '<public-home></public-home>'
});
I am looking for feedback on attempted routes, along with information about where those attempts originated. This way, I can pinpoint the sources of the incorrect includes.
My main issue is identifying incorrectly resolved route requests and I want to be able to log or record information about the routing process.
This is my current approach to resolving the reloading issue with Angular, but I am open to better solutions if they exist!