Most Fable guides assume that you’re starting a new project and that you’re using webpack. But neither of these are required, and it’s actually pretty straightforward to integrate Fable into an existing app if all you have available is
yarn. Using webpack does result in a slightly cleaner integration, but if you’re not already using it, adding webpack to your toolchain is like driving a screw with a sledgehammer.
Alternatively, you can get by with just the
Download and install the .NET Core SDK (even if it’s already installed, it can be useful to make sure you’re using the latest version). The Fable compiler uses this when compiling F# sources. It’s also helpful for managing and testing the F# project.
yarn add fable-compiler fable-splitter).
2. Create an F# Project
There are some Fable project templates for dotnet, but I didn’t find them to be useful. Again, they’re mostly intended for starting a new app. A standard F# library project will do just fine for integrating with an existing app.
dotnet new library --language F#.
Optionally, you can add the Fable.Core package with
Numeric types minefield
pown function to be unreliable. Watch out for this, and test edge cases carefully.