Environments
The Error
Error: ChunkLoadError: Loading chunk <chunk-name> failed.
(missing: <URL>)
Which lines are causing the issue?
After thoroughly investigated the issue and identified the root cause. The following lines of code were the primary contributors to the problem:
import { HubConnectionBuilder } from '@microsoft/signalr';
this._hubConnection = new HubConnectionBuilder()
.withUrl(this.apiUrl, {})
.withAutomaticReconnect([0, 1000, 5000, null])
.build();
What did i try?
When these lines are commented out, the program runs without errors. However, these lines are essential for establishing a connection with SignalR, so they cannot be omitted. In few other similar issues that were closed in Github, it was recommended to use signalr version 8 to fix this issue. We are using v8 but still this issue is not fixed.
Interestingly, this works perfectly with the @angular-devkit/build-angular
builder but encounters issues when used with ngx-build-plus
. At this point, the exact reason for the incompatibility is unclear. We will need further analysis or expert guidance to resolve this while retaining SignalR functionality.
This error is now fixed!
Use this exact version @microsoft/signalr:"8.0.0" instead of any other versions and this error will be fixed :)