Upon upgrading my project to Angular 8, an unexpected error occurs during the build process:
ERROR in HostResourceLoader: loader(C:/myapp/cli/src/app/pages/user-home/user-home.component.html) returned a Promise
i 「wdm」: Failed to compile.
However, saving any file triggers a successful recompilation of the application:
i 「wdm」: Compiling...
i 「wdm」: Compiled successfully.
The initial issue arises from the inability to load the specified template file in templateUrl, as pinpointed within this line in the Angular Compiler resource loader: https://github.com/angular/angular/blob/master/packages/compiler-cli/src/ngtsc/resource_loader.ts#L111. The connection between the template url and the promise return error remains unclear.
What might be causing this error message? It seems likely that there is a bug present in the resource loader, given that on-the-fly recompilation succeeds while the initial build fails.
Update:
This migration originated from Angular 7 with the ng update
command, resulting in minimal alterations.
My usage of webpack 4 was seamless with Angular 7; perhaps certain webpack configurations need adjustment for compatibility with Angular 8.
The error description does not provide sufficient insight into its root cause. Delving into the compiler's source code has yielded no significant findings.
An attempt to recreate the scenario with pure Angular (without webpack) migrated from version 7 to 8, employing markup templates via `templateUrl`, also ended inconclusively.