-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Blazor WebAssembly is loading unnecessary dll. #25949
Comments
Tree shaking (linking) happens on publish only. Could you please try publishing your application and see if you still think it loads unnecessary assemblies? Thanks! |
@SteveSandersonMS |
By default the linker only strips code from framework assemblies, not from NuGet packages you reference. @pranavkm Do you know if we have docs anywhere on how to customize what gets linked? |
@pranavkm
Tried to publish it with But it didn't help. AWSSDK.Core.dll is still loaded by browser. Am I missing here something? |
Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue. This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue! |
Re-opening. This probably shouldn't have been in Discussions. Ping @SimonCropp |
I'm trying to use Blazor WebAssembly hosted by ASP.NET Core. After implementing a page, I saw in Chrome DevTools many of unnecessary dlls are transmitted to client. There is an example of situation. Let's assume we have following structure of projects in the solution:
So basically BlazorApp.Shared project has reference to some other project, which could have many nuget packages. Minimum code to reproduce the issue is available in repo https://github.com/GTmAster/blazor-treeshake
My assumption is Mono Linker does a tree shaking in Release build, so all unused code and libraries will be excluded from resulting web assembly. But when I run my app, I see it loads AWSSDK.Core.dll from the server. Code in BlazorApp.Client doesn't use it, as well as the code in BlazorApp.Server and in BlazorApp.Shared. It is only loaded, because it is referenced in ClassLibrary.
Am I getting the wrong idea about Mono Linker tree shaking? Is the only way to exclude this dll from shipping is to move MyEnum to BlazorApp.Shared and break BlazorApp.Shared -> ClassLibrary reference?
To Reproduce
Minimum code to reproduce the issue is available in repo https://github.com/GTmAster/blazor-treeshake
Further technical details
The text was updated successfully, but these errors were encountered: