Vite plugin that adds Flow type-stripping support using the Flow parser. Current stable version is 0.2.1, released as a stable build. This plugin integrates with Vite's build pipeline to strip Flow type annotations from .js/.jsx files, allowing Vite to handle Flow-typed code without a separate Babel step. Key differentiators: lightweight (uses the official flow-remove-types package), configurable filtering, optional all-files mode, and pretty-printing. Developed by Eazymov and MIT licensed.
npm install vite-plugin-flowVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin with all optional settings explicitly set to defaults in a Vite config file.
Use Vite 2 or higher.
Set filter option like /\.[mc]?jsx?$/ to include .mjs/.cjs.
Only enable 'all' if all your JS files are Flow-typed or you want to be aggressive.
Enable source maps in Vite (build.sourcemap: true) and test thoroughly.
Use 'declare foo: string;' instead of 'foo: string;' for type-only fields to avoid needing this option.
Run 'npm install vite-plugin-flow --save-dev' and ensure project is using ESM (type: module in package.json or .mjs file).
Change to import statement: import vitePluginFlow from 'vite-plugin-flow'
Use import vitePluginFlow from 'vite-plugin-flow' (no braces).