{"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,"search_vec":"'1.1.1':30 'ad':58 'annot':12 'build':81 'bundl':17 'cadenc':34 'comment':40 'compar':64 'contain':38 'current':26 'default':42 'differenti':60 'fast':63 'file':15,37,49 'flow':4,10,20,39,67,72,87 'flow-remove-typ':19 'flowtyp':88 'full':66 'hood':25 'integr':76 'javascript':83 'javascript/flow':14 'lightweight':61 'mainten':33 'minim':32 'mode':53 'option':45 'pipelin':82 'plugin':3,7,86 'pretti':52 'process':47 'provid':50 'remov':21,55 'requir':71 'rollup':2,6,79,85 'rollup-plugin':84 'rollup-plugin-flow':1 'run':75 'seamless':77 'stabl':27 'strip':9,89 'transform':36,68 'type':11,22,56 'use':18 'version':28 'whitespac':59 'without':57","created_at":"2026-04-27T17:03:01.977290+00:00","updated_at":"2026-04-27T17:03:01.977290+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/leebyron/rollup-plugin-flow","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-flow","openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}