After importing MessagePackHubProtocol from @aspnet/signalr-protocol-msgpack inside of an Angular app using the Angular cli, the application will no longer run in the browser.
You will see the following exception in the console.

Clone and run the following app:
https://github.com/QuinntyneBrown/ng-signalr-protocol-msgpack-issue
or
Inside the ngOnInit method, add the following code
var connection = new HubConnectionBuilder()
.withUrl("")
.withHubProtocol(new MessagePackHubProtocol())
.build();
run the app with the console open, and you should see the error. The UI will be blank.
You should see the standard angular cli default page.
I created the following duplicate issue with angular-cli.
https://github.com/angular/angular-cli/issues/14253
I was asked to look at the following comment. https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814
Take a look at https://github.com/aspnet/SignalR/issues/2736#issuecomment-411144971 for a workaround.
triage we can investigate using a newer Buffer package that doesn't rely on global being defined.
Angular broke this intentionally.
https://github.com/angular/angular-cli/issues/9827#issuecomment-386154063
On Wed, 24 Apr 2019, 16:36 BrennanConroy, notifications@github.com wrote:
Take a look at aspnet/SignalR#2736 (comment)
https://github.com/aspnet/SignalR/issues/2736#issuecomment-411144971
for a workaround.@triage we can investigate using a newer Buffer package that doesn't
rely on global being defined.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/AspNetCore/issues/9687#issuecomment-486294144,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADKSKTFHCMCSIF46BZ2FAU3PSB46JANCNFSM4HH4KWKQ
.
Same error here!!!
We'll look and see if there's a good option here. We might end up dropping polyfills for some of these altogether so that each environment can bring an appropriate polyfill.
We aren't going to be able to get to this in 3.0. Moving to the backlog.
So... You're gonna release a version that is not working with Angular?
Is the linked workaround insufficient for you? If so we can bump the priority of this.
Sorry, @anurse I didn't see that workaround!
The workaround worked for me after I added the package "buffer" to package.json.
Edit: Gotta be something better than doing all this to make MessagePack work lol