SignalR icon indicating copy to clipboard operation
SignalR copied to clipboard

Angular 4 / SignalR angular-cli production build fails

Open maartenmensink opened this issue 9 years ago • 4 comments

When trying to incoperate a SignalR hub in to a angular 4 project i encounter a issue when creating a production build with angular-cli.

Repo to reproduce issue: https://github.com/maartenmensink/signal-core-test-prod-build

Steps:

  • npm install
  • ng build --prod --sm --verbose

Should give error:

ERROR in vendor.b0045e4649a2b76539df.bundle.js from UglifyJs
Unexpected token: name (Subject) [C:/projects/test/signal-core-test-prod-build/node_modules/@aspnet/signalr-client/dist/src/Observable.js:3,0][vendor.b0045e4649a2b76539df.bundle.js:17107,6]

maartenmensink avatar Aug 25 '17 13:08 maartenmensink

angular-cli uses UglifyJs and the latter doesn't support ES6 which this repository requires. There are already two issues for that in this repository.

Tragetaschen avatar Aug 25 '17 15:08 Tragetaschen

I have not tried it yet but here is a possible workaround: https://github.com/aspnet/SignalR/issues/729#issuecomment-324569702 (as well as the entire thread about SignalR client and angular-cli).

moozzyk avatar Aug 25 '17 16:08 moozzyk

Angular-cli has updated 1.5.0. It's solved this problem.

Current version of @aspnet/signalr-client: '1.0.0-alpha2-final' in my project. Now i'm using import { HubConnection } from '@aspnet/signalr-client' without errors while production building.

Angular-cli releases link: https://github.com/angular/angular-cli/releases

sniffer327 avatar Nov 02 '17 15:11 sniffer327

@SergBozhko - thanks for the update!

moozzyk avatar Nov 02 '17 15:11 moozzyk