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.
default
✓ const splitter = require('fable-splitter')
✗ import splitter from 'fable-splitter'
fable-splitter is CommonJS only; ESM import not supported.
run
✓ const { run } = require('fable-splitter')
✗ import { run } from 'fable-splitter'
run is a named export in CommonJS; ESM import will fail.
getConfig
✓ const { getConfig } = require('fable-splitter')
✗ import { getConfig } from 'fable-splitter'
getConfig is another named export; use destructuring require.
Shows how to programmatically compile an F# project using fable-splitter's JS API with Babel configuration.
const { run } = require('fable-splitter');
const config = {
entry: 'src/App.fsproj',
outDir: 'out',
babel: {
presets: [['@babel/preset-env', { modules: 'commonjs' }]]
},
allFiles: false,
fable: {
define: ['DEBUG'],
typedArrays: true,
clampByteArrays: false
},
onCompiled: () => console.log('Done!')
};
run(config).catch(err => console.error(err));
fable-splitter --version
Debug
Known issues
breakingIn Fable 2.0, fable-splitter was called via dotnet-fable (e.g. `dotnet fable fable-splitter`). Starting from Fable 2.1, call fable-splitter directly (e.g. `npx fable-splitter`).fixUpgrade fable-compiler to >=2.1.0 and call `npx fable-splitter` directly.
affects: >=2.0.0 <2.1.0
deprecatedFable 5.x is in release candidate; fable-splitter may be replaced or significantly changed. Check Fable 5 migration guide.fixStay on fable-splitter 2.x for stable releases, or migrate to Fable 5's built-in CLI when stable.
affects: >=5.0.0-rc.1 <5.0.0
gotchaThe `--commonjs` flag is required if you want CommonJS module output; otherwise, Fable outputs ES modules by default.fixAdd `--commonjs` to CLI or set `modules: 'commonjs'` in Babel config.
affects: >=2.0.0
gotchaPath resolution macros `${entryDir}` and `${outDir}` are only replaced in string literals, not in variables or interpolated strings.fixUse `${entryDir}` directly in F# string literals, not in runtime string concatenation. affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'fable-compiler'
fable-compiler is a peer dependency and must be installed separately.
fixRun `npm install fable-compiler` alongside `fable-splitter`.
TypeError: run is not a function
Importing using ESM syntax (import) instead of CommonJS require.
fixUse `const { run } = require('fable-splitter')` instead of `import { run } from 'fable-splitter'`. Error: Unknown command: fable-splitter
Attempting to run `dotnet fable fable-splitter` with Fable 2.1+.
fixCall `npx fable-splitter` directly; the dotnet-fable CLI is no longer needed.
SyntaxError: Unexpected token 'export'
Running a Fable-compiled file that uses ES module syntax in a Node.js environment without CommonJS.
fixAdd `--commonjs` flag or configure Babel to transform modules to CommonJS.
Audit
Dependencies
fable-compilerrequiredPeer dependency required for F# to JS compilation