Registry / devops / rollup-plugin-fable

rollup-plugin-fable

JSON →
library2.0.0jsnpmunverified

Rollup plugin for Fable, the F# to JavaScript compiler. Current version 2.0.0 enables bundling F# projects with Rollup by invoking the Fable compiler during the build process. Maintained as part of the Fable ecosystem, it integrates with Babel for transpilation and supports options like custom compiler directives, typed arrays, and Fable plugins. Key differentiators: seamless integration with F# tooling, supports Fable's compile-time metaprogramming, and requires careful path resolution to avoid conflicts with NuGet cache.

npm install rollup-plugin-fable
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-FABL
R
rollup-plugin-fable
devopsjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

default
import fable from 'rollup-plugin-fable'
const fable = require('rollup-plugin-fable')
This package is ESM-only and does not support CommonJS require().
default
import fable from 'rollup-plugin-fable'
import { fable } from 'rollup-plugin-fable'
The default export is the plugin function; named exports are not available.
default
const fable = (await import('rollup-plugin-fable')).default
const fable = require('rollup-plugin-fable')
For CommonJS require, use dynamic import or upgrade to ESM.

Configures Rollup to bundle an F# project using Fable, with Babel for transpilation and node-resolve for module resolution.

import path from 'path'; import fableUtils from 'fable-utils'; import fable from 'rollup-plugin-fable'; import nodeResolve from 'rollup-plugin-node-resolve'; function resolve(relativePath) { return path.join(__dirname, relativePath); } var babelOptions = fableUtils.resolveBabelOptions({ 'presets': [ ['es2015', {'modules': false}] ] }); export default { entry: resolve('./my-app.fsproj'), dest: resolve('./dist/bundle.js'), plugins: [ fable({ babel: babelOptions }), nodeResolve({ customResolveOptions: { moduleDirectory: resolve('./node_modules') } }) ], format: 'cjs' };
Debug
Known issues
gotchaPath resolution: Must use absolute paths for entry and node_modules to avoid conflicts with Fable pulling files from NuGet cache.
fix
Use path.join(__dirname, relativePath) for all file paths.
affects: >=0.0.0
gotchaBabel options must be resolved via fableUtils.resolveBabelOptions to share the same instance across plugins.
fix
Use fableUtils.resolveBabelOptions() to create babel options object.
affects: >=0.0.0
gotchaDefineConstants property in .fsproj is ignored; use the 'define' option instead.
fix
Pass array of compiler directives via define option, e.g., fable({ define: ['DEBUG'] }).
affects: >=0.0.0
gotchaRequires @babel/core as a peer dependency. Missing it causes runtime errors.
fix
Install @babel/core: npm install --save-dev @babel/core
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module '@babel/core'
Missing peer dependency @babel/core.
fix
npm install --save-dev @babel/core
Error: Plugin returned an object which has a function but not a generateBundle property
Incorrect usage of the plugin in rollup.config.js (e.g., calling fable() incorrectly).
fix
Ensure fable is invoked as a function in the plugins array, e.g., plugins: [fable({ babel: babelOptions })]
Error: Cannot resolve module 'fable-utils'
Missing dependency fable-utils.
fix
npm install --save-dev fable-utils
TypeError: fableUtils.resolveBabelOptions is not a function
Incorrect import or version of fable-utils.
fix
Ensure fable-utils is installed and imported correctly: import fableUtils from 'fable-utils'
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
@babel/corerequiredRequired peer dependency for Babel transpilation of compiled JS
Agent activity
8 hits · last 30 days
node
6
Resources
rollup-plugin-fable — npm install rollup-plugin-fable · libregistry