2

Environments

  • Angular Version: ~18.2.2
  • Signalr: @microsoft/signalr: "^8.0.7"
  • Microfrontend Library: @angular-architects/module-federation: 18.0.4
  • Webpack: 5.94.0
  • Webpack-cli: ^5.1.4
  • ngx-build-plus: 18.0.0
  • Build -> "builder": "ngx-build-plus:browser"
  • Serve -> "builder": "ngx-build-plus:dev-server"

The Error

Error: ChunkLoadError: Loading chunk <chunk-name> failed.  
(missing: <URL>)

Click here for Error image

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.

2 Answers 2

1

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 :)

Sign up to request clarification or add additional context in comments.

Comments

1

If your using angualr18 version then Please use *@microsoft/signalr:"8.0.0"**version.I migrated my project from 14 to 18 which inclues module federation also.I thought it was federation issue when I used @microsoft/signalr:"8.0.7" when I user @microsoft/signalr:"8.0.0" then issue resolved.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.