Vite Plugin
The @floeorg/vite-plugin package lets Vite transform .fl files during development and production builds.
Installation
Section titled “Installation”npm install -D @floeorg/vite-pluginMake sure floe is installed and available in your PATH.
Configuration
Section titled “Configuration”import { defineConfig } from "vite"import floe from "@floeorg/vite-plugin"
export default defineConfig({ plugins: [floe()],})Options
Section titled “Options”floe({ // Path to the floe binary (default: "floe") compiler: "/usr/local/bin/floe",})TypeScript Setup
Section titled “TypeScript Setup”Add allowArbitraryExtensions and rootDirs to your tsconfig.json so TypeScript can resolve .fl imports:
{ "compilerOptions": { "allowArbitraryExtensions": true, "rootDirs": ["./src", "./.floe/src"] }}If you use path aliases (like #/ or @/), also add .floe/ lookups to your paths:
{ "compilerOptions": { "paths": { "#/*": ["./src/*", "./.floe/src/*"], "@/*": ["./src/*", "./.floe/src/*"] } }}The compiler generates .d.fl.ts type declarations in the .floe/ directory, and rootDirs tells TypeScript to treat src/ and .floe/src/ as a single merged directory. This lets TypeScript resolve types for imports like import { Header } from "./header.fl" automatically, without polluting the source tree with generated files.
How It Works
Section titled “How It Works”- Vite encounters a
.flimport - The plugin calls
floeto compile it to TypeScript - The TypeScript output is passed to Vite’s normal pipeline
- Hot Module Replacement works automatically
With React
Section titled “With React”import { defineConfig } from "vite"import react from "@vitejs/plugin-react"import floe from "@floeorg/vite-plugin"
export default defineConfig({ plugins: [ floe(), // must come before React plugin react(), ],})File Structure
Section titled “File Structure”my-app/ src/ App.fl # Floe component utils.fl # Floe utilities legacy.tsx # Existing TypeScript (works alongside) vite.config.ts package.jsonFloe files and TypeScript files coexist. Adopt incrementally.