To write a library that can be used in Fable you only need to fulfill a few conditions:

  • Don't use FSharp.Core/BCL APIs that are not compatible with Fable.
  • Keep a simple .fsproj file: don't use MSBuild conditions or similar.
  • Include the source files in the Nuget package in a folder named fable.

The last point may sound complicated but it's only a matter of adding a couple of lines to your project file and let the dotnet pack command do all the rest.

<!-- Add source files to "fable" folder in Nuget package -->
    <Content Include="*.fsproj; **\*.fs; **\*.fsi" PackagePath="fable\" />

That's all it takes to make your library compatible with Fable! In order to publish the package to Nuget check the Microsoft documentation or alternatively you can also use Fake.


It's a good idea to write unit tests for your library to make sure everything works as expected before publishing. The simplest way for that is to use a JS test runner like Mocha, as in this sample. Or you can also use a library like Fable.Mocha containing more tools for Fable projects.