{"id":25341,"library":"esbuild-plugin-flow","title":"esbuild-plugin-flow","description":"Esbuild plugin for stripping Flow type annotations using flow-remove-types. Current version 0.3.2 (latest). Installation requires direct GitHub URL. Designed for custom build scripts, not CLI. Key differentiator: integrates Flow type stripping into esbuild bundling. Alternatives like @babel/preset-flow require Babel; this plugin is lightweight. Entry point files are not processed (known limitation). Options include regex for file matching and optional force flag to strip even without @flow pragma.","status":"active","version":"0.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/dalcib/esbuild-plugin-flow","tags":["javascript","esbuild","plugin","flow"],"install":[{"cmd":"npm install esbuild-plugin-flow","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-flow","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-flow","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"runtime dependency for stripping Flow type annotations","package":"flow-remove-types","optional":false},{"reason":"peer dependency required for plugin integration","package":"esbuild","optional":false}],"imports":[{"note":"Package does not export ESM; CommonJS require is required.","wrong":"import flow from 'esbuild-plugin-flow'","symbol":"esbuild-plugin-flow","correct":"const flow = require('esbuild-plugin-flow')"},{"note":"Default export is a function that returns a plugin.","symbol":"default","correct":"const flow = require('esbuild-plugin-flow')"},{"note":"First argument must be a RegExp object, not a string.","wrong":"flow('regex')","symbol":"flow (function)","correct":"flow(/regex/, false)"}],"quickstart":{"code":"const esbuild = require('esbuild');\nconst flow = require('esbuild-plugin-flow');\nesbuild.build({\n  entryPoints: ['index.js'],\n  outfile: 'dist/bundle.js',\n  bundle: true,\n  plugins: [flow(/\\.flow\\.jsx?$/)]\n}).catch(() => process.exit(1));","lang":"javascript","description":"Basic usage: require the plugin, pass a RegExp matching .flow.js or .flow.jsx files, and include in esbuild plugins array."},"warnings":[{"fix":"Move entry point content into a non-entry module or use a separate build step for the entry file.","message":"Entry point files are not processed by this plugin due to esbuild limitations; Flow types in entry point will not be stripped.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Install via: npm i --dev https://github.com/dalcib/esbuild-plugin-flow","message":"Installation requires GitHub URL, not npm registry. 'npm i --dev esbuild-plugin-flow' will fail.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass a RegExp literal, e.g., /\\.flow\\.jsx?$/","message":"The regex argument must be a RegExp object; passing a string will cause unexpected behavior.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use require('esbuild-plugin-flow') instead.","message":"Plugin does not support ESM; using import syntax will fail.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure you ran 'npm install https://github.com/dalcib/esbuild-plugin-flow' from the project root.","cause":"Package installed from GitHub URL, but Node.js module resolution may not find it if global symlinks are missing.","error":"Cannot find module 'esbuild-plugin-flow'"},{"fix":"Use const flow = require('esbuild-plugin-flow'); flow(/regex/);","cause":"Using import instead of require, or not invoking the default export correctly.","error":"TypeError: flow is not a function"},{"fix":"Ensure the argument to flow() is a RegExp, e.g., /\\.flow\\.jsx?$/","cause":"Passing a string instead of a RegExp to the flow function, causing esbuild to receive an invalid plugin object.","error":"Error: The plugin must be a function or an object with a 'name' and 'setup' function."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}