FSharp.Data icon indicating copy to clipboard operation
FSharp.Data copied to clipboard

Is it possible to make this library trimmable by default

Open albertwoo opened this issue 2 years ago • 3 comments

Description

I am using this library in blazor wasm application, but this library's bundle size is 1008kb which is a lot for a web application. I also created similar ticket for FSharp.Data.Adaptive, which they already made it hanppen. https://github.com/fsprojects/FSharp.Data.Adaptive/issues/104 And the result is pretty good.

Known workarounds

People can add below stuff to their own application to make it work. But it is better to have it support by default.

<Target Name="ConfigureTrimming" BeforeTargets="PrepareForILLink">
<ItemGroup>
	<ManagedAssemblyToLink Condition="'%(Filename)' == 'FSharp.Data'">
		<TrimMode>link</TrimMode>
		<IsTrimmable>true</IsTrimmable>
	</ManagedAssemblyToLink>
</ItemGroup>
</Target>

albertwoo avatar May 02 '22 01:05 albertwoo

This library does make a bit of use of reflection. I'm not sure what that means for trimmability.

cartermp avatar May 02 '22 03:05 cartermp

Then below stuff should be able to add to the project file, so other people do not need to use the workaround.

<TrimMode>link</TrimMode>
<IsTrimmable>true</IsTrimmable>

albertwoo avatar May 02 '22 04:05 albertwoo

Here is the docs: https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming

albertwoo avatar May 02 '22 04:05 albertwoo