Skip to content

fix: don't ship source files in binding packages - #16

Merged
MangelMaxime merged 1 commit into
mainfrom
fix/binding-should-not-ship-source
Sep 27, 2026
Merged

MangelMaxime merged 1 commit into
mainfrom
fix/binding-should-not-ship-source

Conversation

@MangelMaxime

Copy link
Copy Markdown
Member

Problem

CreateFablePackageFiles includes the project's @(Compile) files (and the .fsproj) under the fable/ folder of the produced NuGet package. Its comment says this is "if FablePackageType is a library", but the target had no Condition, so it ran for binding packages too.

As a result, a pure-interop binding shipped its full F# source in fable/. Fable prefers that source over the compiled DLL, so every consumer recompiles the whole binding from source on each build. For a large binding this is very expensive (e.g. a ~194k-line binding is ~27s of Fable transform per consumer build, vs ~0.6s when consumed as a plain DLL).

Fix

Add the missing condition so the source is only packaged for library packages:

<Target Name="CreateFablePackageFiles"
    Condition="'$(FablePackageType)' == 'library'"
    ... >

A binding package now ships only its lib/*.dll, and Fable consumes it from the assembly (interfaces + [<Import>]/[<Emit>]/[<Erase>] metadata) without recompiling it.

Test

Added should not include any source file for a binding package: it packs a new binding-with-files fixture and asserts the nupkg contains no fable/ entries. The existing library tests still assert that library packages do ship their source, so both directions are covered. Full suite: 23/23 passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_011rgT2YXmo7LaUFmMFNpx9k

@MangelMaxime
MangelMaxime merged commit 1147fa3 into main Sep 27, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant