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-fableVerified import paths — ran on the pinned version, not inferred.
Configures Rollup to bundle an F# project using Fable, with Babel for transpilation and node-resolve for module resolution.
Use path.join(__dirname, relativePath) for all file paths.
Use fableUtils.resolveBabelOptions() to create babel options object.
Pass array of compiler directives via define option, e.g., fable({ define: ['DEBUG'] }).Install @babel/core: npm install --save-dev @babel/core
npm install --save-dev @babel/core
Ensure fable is invoked as a function in the plugins array, e.g., plugins: [fable({ babel: babelOptions })]npm install --save-dev fable-utils
Ensure fable-utils is installed and imported correctly: import fableUtils from 'fable-utils'