I'm working on an Angular 2 project (angular cli 1.3.2) that is structured with multiple modules and lazy loading. In my main module, I have the following code to load sub-modules within my router:
{
path: 'module2',
loadChildren: 'modules/module2/module2.module.ts#Module2Module',
canActivate: [Guard]
},
However, when I run ng serve
, I encounter the following error message:
ERROR in Could not resolve "modules/module2/module2.module.ts" from "<..>/app/app.module.ts".
Oddly enough, whenever I save any file in the project (triggering a re-build), the build is successful and both modules function correctly without needing to actually make any changes. Has anyone experienced this issue before or know of a way to resolve it?
Any help would be greatly appreciated.