-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shrink SignalR JS client (to 11kB compressed) #30320
Shrink SignalR JS client (to 11kB compressed) #30320
Conversation
Nice, is the main benefit from using terser instead of uglify-js? We'll need to discuss some of the version updates with the team before merging this. |
|
68d1d19
to
6611802
Compare
Note: es2019 is already being used by Blazor aspnetcore/src/Components/Web.JS/tsconfig.json Lines 8 to 9 in a28da74
|
Yep, I'm not sure if SignalR needs to support IE11 or so though. That said, it shouldn't be hard to produce a separate ES5 bundle I think. I've put a link on this PR to the issue we have for doing this on Blazor so that we don't loose track of it. Thanks @benaadams for doing this work! |
3ea529a
to
d9ad305
Compare
.NET 6.0 is coming out in Nov 2021; Teams has already dropped support for IE11 (Aug 17 2020) and Microsoft 365 drops support on Aug 17 2021 and Microsoft Edge supports Windows 7 so... 🤷♂️ |
We don't support IE11. You need to add polyfills to get IE11 support AFAIK |
d9ad305
to
2d8ab24
Compare
This is great! |
2d8ab24
to
1be32ca
Compare
20961d1
to
555fe47
Compare
555fe47
to
be2e537
Compare
Required docs change
|
@benaadams really nice to see this coming along. Let me know when you are ready for me to review, but so far what I've seen looks great. |
eb358bf
to
c0a3f76
Compare
@BrennanConroy feel free to merge when you are happy. |
There are a couple broken npm unit tests. I have created PR #30409 to address the issue with them not showing up in the CI. |
Fixed, one was irrelevant and other was internals visible to (e.g. remove the |
Removed this time 😀 |
a1b86bc
to
1ba0197
Compare
Merged feedback commits to retrigger CI (transient error) |
Same failures with submodules 😥
|
@pranavkm can you help out @benaadams here since you've been playing around this area? |
I could try a rebase? Bit weird getting the submodules only fails on one platform though... |
1ba0197
to
37373c2
Compare
@benaadams I suspect it has to do with #30445 |
Sigh... now
|
🥳 |
Thanks @benaadams ! |
Highlights
Significantly shrinks the uncompressed sizes of SignalR, MsgPack and Blazor.Server; and their corresponding compressed sizes. Leading to faster downloads and less JS parsing and compiling by the browser, allowing for faster start-up.
Shrinks
signalr.min.js
by91 kB
(now10 kB
br compressed,12 kB
gz compressed)Shrinks
blazor.server.js
by96 kB
(now28 kB
br compressed,33 kB
gz compressed)Shrinks add-on msgpack by
112 kB
(now8 kB
br compressed,9 kB
gz compressed)Don't need to add an additional
script
reference tomsgpack5.js
when using mspackMain changes
class
)"sideEffects": false
; so tree-shaking can work better"es6-promise/dist/es6-promise.auto.js"
pollyfilles2019
rather thanes5
and dropped the "es2015.promise" and "es2015.iterable" pollyfillsNote: es2019 is already being used by Blazor
aspnetcore/src/Components/Web.JS/tsconfig.json
Lines 8 to 9 in a28da74
msgpack5
from@msgpack/msgpack
as it requires less pollyfills, is typescript & module awareRequired docs change
@microsoft/signalr-protocol-msgpack
package for msgpack; don't need to includemsgpack5
which means its an additional29 kB
rather than140 kB
to use msgpack rather than Json (protocol-msgpack16 kb
+ msgpack5124 kB
)Sizes
SignalR before (130 kB minimized)
SignalR after (39 kB minimized, 10 kB br compressed, 12 kB gz compressed)
Shrinks
blazor.server.js
by 45% from212 kb
to116 kB
(to28 kB
br compressed,33 kB
gz compressed)Addresses #30319
Addresses #29904