{"id":22669,"library":"vite-plugin-flow","title":"vite-plugin-flow","description":"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.","status":"active","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/Eazymov/vite-plugin-flow","tags":["javascript","vite","flow","plugin","esbuild","vite-plugin"],"install":[{"cmd":"npm install vite-plugin-flow","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-flow","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-flow","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for stripping Flow type annotations from JavaScript files.","package":"flow-remove-types","optional":false},{"reason":"Peer dependency; required as the plugin runs in the Vite environment.","package":"vite","optional":false}],"imports":[{"note":"Default ESM import; CommonJS require() fails because package is ESM-only.","wrong":"const vitePluginFlow = require('vite-plugin-flow')","symbol":"vitePluginFlow","correct":"import vitePluginFlow from 'vite-plugin-flow'"},{"note":"Options type is exported; use import type for TypeScript.","wrong":"","symbol":"Options","correct":"import type { Options } from 'vite-plugin-flow'"},{"note":"Default export, not named. Named import will be undefined.","wrong":"import { vitePluginFlow } from 'vite-plugin-flow'","symbol":"vitePluginFlow (default export)","correct":"import vitePluginFlow from 'vite-plugin-flow'"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite';\nimport vitePluginFlow from 'vite-plugin-flow';\n\nexport default defineConfig({\n  plugins: [\n    vitePluginFlow({\n      all: false,\n      pretty: false,\n      ignoreUninitializedFields: false\n    })\n  ]\n});","lang":"javascript","description":"Shows how to configure the plugin with all optional settings explicitly set to defaults in a Vite config file."},"warnings":[{"fix":"Use Vite 2 or higher.","message":"Plugin only works with Vite 2+ (ESM-based). It does not support Vite 1.x.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set filter option like /\\.[mc]?jsx?$/ to include .mjs/.cjs.","message":"File .jsx? filtering by default; if using .mjs or .cjs files, you must provide a custom filter regex.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Only enable 'all' if all your JS files are Flow-typed or you want to be aggressive.","message":"The 'all' option bypasses @flow pragma; use with caution as it will attempt to strip types from all JS files regardless of pragma.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Enable source maps in Vite (build.sourcemap: true) and test thoroughly.","message":"When using 'pretty: true', the output may change line lengths, which could break source maps if not properly configured.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use 'declare foo: string;' instead of 'foo: string;' for type-only fields to avoid needing this option.","message":"The 'ignoreUninitializedFields' option is non-standard; it removes uninitialized class fields like 'foo;' or 'foo: string;' which is not spec-compliant. Prefer using 'declare' for type-only fields.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install vite-plugin-flow --save-dev' and ensure project is using ESM (type: module in package.json or .mjs file).","cause":"Missing dependency or wrong module resolution due to ESM-only package.","error":"Cannot find module 'vite-plugin-flow'"},{"fix":"Change to import statement: import vitePluginFlow from 'vite-plugin-flow'","cause":"Using CommonJS require() to import an ES module.","error":"require() of ES Module ... not supported"},{"fix":"Use import vitePluginFlow from 'vite-plugin-flow' (no braces).","cause":"Using named import { vitePluginFlow } instead of default import.","error":"TypeError: vitePluginFlow is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}