Registry / devops / fable-compiler

fable-compiler

JSON →
library2.13.0jsnpmunverified

Fable is an F# to JavaScript/TypeScript, Python, Dart, Rust, and Erlang/Elixir (BEAM) compiler. Current stable version is 2.13.0 (npm package for CLI integration) with compiler core at v5.0.0. The project releases frequently with alphas/RCs. Unlike F# Compiler Services directly, Fable translates F# into clean, readable code for multiple targets. Key differentiator: it covers F#-to-multiple-backends in one tool, with growing language support including quotations and inlining. Note: npm 'fable-compiler' package is a wrapper for JS-based tooling; the actual compiler is the dotnet tool 'fable'.

devopsserialization
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

F# functions are exported as named exports; avoid default import.

import { add, multiply } from './fsharp-module'

When using fable-library directly, use subpath imports.

import { FSharpRef } from 'fable-library/Builtins'

Fable.Core is separate from fable-library; ensure correct package.

import { emitExpr } from 'fable-core'

Compiles an F# project to JavaScript using the dotnet tool, then imports the generated module.

// 1. Install Fable dotnet tool: // > dotnet tool install --global fable // 2. Create an F# project with fable.config.json // Example fable.config.json: // { // "sourceMaps": true, // "target": "javascript" // } // 3. Compile F# to JavaScript: // > dotnet fable fsharp-project.fsproj --outDir ./output --lang js // 4. In your JavaScript: // import { greet } from './output/MyModule.js'; // console.log(greet("World"));
fable --version
Debug
Known footguns
breakingFable 5 requires .NET 8 SDK and has breaking changes in target output; references to Fable.Core libraries must be updated.
deprecatedThe 'fable-compiler' npm package is deprecated in favor of dotnet tool; direct npm usage for compilation is discouraged.
gotchaString interpolation format specifiers may be dropped or cause compilation errors in non-JS targets (Python, Dart, Rust, BEAM).
gotchaFable does not support all .NET APIs; you must use Fable-specific equivalents (e.g., 'FSharp.Collections.Array' instead of 'System.Array').
breakingFrom v5.0.0-rc.6: Python modulo behavior for bigint changed from truncated (.NET semantics) to floored (Python semantics), breaking existing code.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
12 hits · last 30 days
ahrefsbot
4
gptbot
3
claudebot
3
bingbot
1
chatgpt-user
1
Resources