Aspnetcore-angular-universal: Prod Build fails when using signalr

Created on 14 Feb 2018  路  4Comments  路  Source: TrilonIO/aspnetcore-angular-universal

Similar to issue Prod build failed #460 , but when using signalr the prod build fails with:

ERROR in main-client.js from UglifyJs
Unexpected token: name (NullLogger) [main-client.js:84763,6]

After removing webpack.optimize.UglifyJsPlugin lines from webpack.config.js it publishes OK, but obviously files don't get minified.

There is a recent related fix in signalr, https://github.com/selfdeceited/bird-aggregator/commit/ef13204c30a8dcb250df8fb8eaf89b8533d85fc8 using uglifyjs-webpack-plugin instead of webpack.optimize.UglifyJsPlugin. I've tried this fix but it causes the build to fail with this template

Anyone have any pearls of wisdom?

3rd party libraries

Most helpful comment

For anyone using the newer version SignalR "@aspnet/signalr": "1.0.0-preview1-final" (At this time) the issue is supposed to be fixed!? but I found myself having to convert the ES6 signalr.js to ES5 using babel

All 4 comments

I had the same problem, and found this thread, but I am not sure what is the current state of a problem.

Found a workaround on https://github.com/aspnet/SignalR/issues/983 which is working for me.

Need to replace:
import { HubConnection } from '@aspnet/signalr-client';
with:
import { HubConnection } from '@aspnet/signalr-client/dist/browser/signalr-clientES5-1.0.0-alpha2-final.min.js'

And I can now build for production with webpack.optimize.UglifyJsPlugin

For anyone using the newer version SignalR "@aspnet/signalr": "1.0.0-preview1-final" (At this time) the issue is supposed to be fixed!? but I found myself having to convert the ES6 signalr.js to ES5 using babel

@CybrZr00 @peterdobson @MaklaCof
It sounds like @aspnet/signalr is packaging their bundles incorrectly and bundling them as es2015, they should transpile them down to es5.
Try opening an issue there, they shouldn't -only- be publishing es2015, that must be a mistake!

Changing one line in their tsconfig to es5 would fix it, strangely enough.

Was this page helpful?
0 / 5 - 0 ratings