-
Notifications
You must be signed in to change notification settings - Fork 446
Webpack builds signalr-client incorrectly #416
Comments
Can you show your project/minimal repro? I have not tried Angular and webpack yet but I am interesting how it uses and compiles the code. |
@SergeiNet - thank you - it is very helpful. I will try to look into it in the coming days. |
@moozzyk - One of the possible solutions to fix this issue is to change module: "umd" to "module": "commonjs" in the SignalR/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/tsconfig.json |
@SergeiNET - I think it would break other (browser/js) scenarios |
Also facing this issue while using webpack, are you aware of a workaround in the meantime? |
And me too |
So I just copied the file signalr-client.js from node_modules into a separate folder of my project, then import this for example |
@boombang cheers, thats got it working for me in the meantime |
@boombang @JohnLampitt no need to copy from node_modules. You can just do this:
Although I'm just considering this a workaround until the errors are fixed. |
@dandax I tried your workaround but get this error: ERROR in vendor.5360e0958d9b8e1ce395.bundle.js from UglifyJs any workaround for that? |
@SergeiNET #416 (comment) was spot on - webpack fails on umd modules. Changing module type to commonjs in the tsconfig fixes the issue. It does not affect the single-file version meant for browser because browserify can handle commonjs modules just fine. I was actually able to make the TS client work in node as well after this change: https://twitter.com/moozzyk/status/898650110468292608 @Marcelh1983 - the error you are seeing seems to be an issue where UglifyJs does not support ES6. Here is a thread in the WebPack repo about this issue. |
@moozzyk this issue references using the SignalR client with Angular and the Angular CLI does not currently support ES6 (angular/angular-cli#2907) so we're actually worse off now than before |
@dandax - The client will not compile for ES5 at the moment. I hope they will be able to fix this problem before we ship the final version of the signalr client - this is impacting many users and needs to be fixed on the angular-cli side. |
@moozzyk Thanks for looking into the Uglify issue. I will keep track of the angular-cli issue |
I tried to use signalr-client with Angular 2 and webpack.
Webpack throws following warnings:
When I tried to load my application I got following error:
I found that webpack built code ( ./~/signalr-client/dist/src/index.js):
into
So I assume that issue occured because of using require in these places.
The text was updated successfully, but these errors were encountered: