{"id":22030,"library":"rollup-plugin-flow","title":"rollup-plugin-flow","description":"A Rollup plugin to strip Flow type annotations from JavaScript/Flow files before bundling, using flow-remove-types under the hood. Current stable version is 1.1.1, with minimal maintenance cadence. It transforms files containing @flow comments by default, with an option to process all files. Provides a 'pretty' mode that removes types without adding whitespace. Differentiators: lightweight and fast compared to full Flow transformation; does not require Flow itself to run; integrates seamlessly with Rollup's build pipeline.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/leebyron/rollup-plugin-flow","tags":["javascript","rollup-plugin","flow","flowtype","strip"],"install":[{"cmd":"npm install rollup-plugin-flow","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-flow","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-flow","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin designed for Rollup >=0.20","package":"rollup","optional":true},{"reason":"runtime dependency to strip Flow type annotations","package":"flow-remove-types","optional":false}],"imports":[{"note":"CommonJS require still works in older versions; this is the default export","wrong":"const flow = require('rollup-plugin-flow');","symbol":"default","correct":"import flow from 'rollup-plugin-flow'"},{"note":"The package exports a single function as default export, not a named export. Named import will be undefined.","wrong":"import { flow } from 'rollup-plugin-flow'","symbol":"flow function","correct":"import flow from 'rollup-plugin-flow';\nplugins: [ flow({ all: true }) ]"},{"note":"Must call the imported function to create the plugin instance.","wrong":"plugins: [ { transform: ... } ]","symbol":"usage in rollup config","correct":"import flow from 'rollup-plugin-flow';\nexport default {\n  input: 'src/index.js',\n  plugins: [flow()]\n}"}],"quickstart":{"code":"import flow from 'rollup-plugin-flow';\nimport { rollup } from 'rollup';\n\nconst bundle = await rollup({\n  input: 'src/index.js',\n  plugins: [\n    flow({\n      all: true,\n      pretty: false\n    })\n  ]\n});\n\nconst { output } = await bundle.generate({ format: 'esm' });\nconsole.log(output[0].code);","lang":"javascript","description":"Basic usage: import the default export, call it with options, pass as plugin to Rollup."},"warnings":[{"fix":"Ensure this plugin is first in the plugins array if other plugins should see untyped code; else place after Babel if Babel should handle Flow.","message":"Flow transformation is applied before bundling, so it cannot be combined with other transforms that depend on flow annotations.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Run flow check as a separate step before bundling.","message":"The plugin does not type-check the code; it only removes annotations. For type checking, run Flow separately.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Change `plugins: [flow]` to `plugins: [flow()]` or `plugins: [require('rollup-plugin-flow')()]`","message":"In version 1.1.0, the default export changed from an object to a function. Old usage `plugins: [flow]` will break; must call `flow()`","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"Update rollup to a version compatible with the plugin's API (rollup <0.50)","message":"Rollup changed its plugin API; the plugin expects a `transform` hook that receives `{code, map}`, not `source`","severity":"deprecated","affected_versions":">=0.25.0"},{"fix":"Set `sourcemap: true` in rollup config and provide input sourcemap if available.","message":"When using `pretty: true`, source maps are recommended but not generated by default; output may have incorrect line mappings.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install flow-remove-types --save-dev","cause":"flow-remove-types is not installed","error":"Error: Cannot find module 'flow-remove-types'"},{"fix":"Update to version 1.1.1 and call `flow()` instead of just `flow`","cause":"Using an older version of the plugin where default export was an object","error":"TypeError: flow is not a function"},{"fix":"Add `@flow` comment to files or set `all: true` in plugin options","cause":"Files do not contain @flow comment; `all` option not set","error":"The plugin does nothing — no types removed"},{"fix":"Ensure rollup-plugin-flow is added to plugins array and called correctly","cause":"Flow syntax not stripped before bundling; plugin not included or misconfigured","error":"Unexpected token ':'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}