{"id":20035,"library":"flow-babel-webpack-plugin","title":"flow-babel-webpack-plugin","description":"Flow Babel Webpack Plugin (v1.1.1, last released in 2017) is a Webpack plugin that integrates Flow type checking into the Webpack build process using Babel to strip type annotations via transform-flow-comments. It provides real-time Flow error or warning reports in the Webpack output. Unlike alternatives like flow-webpack-plugin or babel-plugin-transform-flow-strip-types, this plugin specifically works with the transform-flow-comments approach to preserve type annotations as comments for Flow checks, while also allowing custom error formatting and warning-only mode. The package has not been updated in years and likely has compatibility issues with modern Webpack (4/5) and Babel (7+); it targets Webpack 1.x/2.x and Babel 6.","status":"deprecated","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/zhirzh/flow-babel-webpack-plugin","tags":["javascript","flow","flowtype","babel","webpack"],"install":[{"cmd":"npm install flow-babel-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add flow-babel-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add flow-babel-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Babel transformation in Webpack pipeline","package":"babel-core","optional":false},{"reason":"Required to run Babel in Webpack","package":"babel-loader","optional":false},{"reason":"Requires Webpack v1.x or v2.x; not compatible with v3+","package":"webpack","optional":false},{"reason":"Required to convert Flow type annotations into comments","package":"babel-plugin-transform-flow-comments","optional":false}],"imports":[{"note":"Package does not export named exports or support ESM. Use CommonJS require().","wrong":"import FlowBabelWebpackPlugin from 'flow-babel-webpack-plugin';","symbol":"default","correct":"const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');"},{"note":"Only default export is available. Destructuring will fail.","wrong":"const { FlowBabelWebpackPlugin } = require('flow-babel-webpack-plugin');","symbol":"FlowBabelWebpackPlugin","correct":"const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin'); const plugin = new FlowBabelWebpackPlugin({ warn: true });"},{"note":"Must instantiate with new. Passing the class reference will not work.","wrong":"plugins: [ FlowBabelWebpackPlugin ]","symbol":"new FlowBabelWebpackPlugin()","correct":"plugins: [ new FlowBabelWebpackPlugin() ]"}],"quickstart":{"code":"// Install dependencies\n// npm i -D babel-core@6 babel-loader@7 webpack@2 babel-plugin-transform-flow-comments flow-babel-webpack-plugin\n\n// .babelrc\n{ \"plugins\": [\"transform-flow-comments\"] }\n\n// webpack.config.js\nconst FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');\n\nmodule.exports = {\n  entry: './index.js',\n  output: { filename: 'build.js' },\n  module: {\n    loaders: [\n      { test: /\\.js$/, loader: 'babel' }\n    ]\n  },\n  plugins: [\n    new FlowBabelWebpackPlugin({\n      warn: false,\n      formatter: function (errorCode, errorDetails) {\n        return 'Flow error ' + errorCode + ': ' + errorDetails;\n      }\n    })\n  ]\n};","lang":"javascript","description":"Shows setup of .babelrc and webpack.config.js to run Flow type checking via Webpack plugin."},"warnings":[{"fix":"Migrate to flow-webpack-plugin (if available) or remove this plugin and run Flow separately via CLI or script.","message":"This plugin only works with Webpack v1.x or v2.x. Webpack v4/v5 use different plugin API and this plugin will fail silently or throw errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure .babelrc contains 'transform-flow-comments' (not 'transform-flow-strip-types').","message":"Requires babel-plugin-transform-flow-comments to be in .babelrc; using babel-plugin-transform-flow-strip-types will strip type annotations and Flow will not run.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using alternative tools like 'flow-remove-types' or running Flow separately.","message":"Package is not maintained since 2017; no support for Babel 7, Webpack >=3, or Flow >=0.80.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Install flow-bin as a devDependency: npm i -D flow-bin and ensure node_modules/.bin is in PATH when running webpack.","message":"If Flow is not installed globally or in node_modules, the plugin will fail with 'flow: not found' error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Handle errors differently if needed; no alternative option available.","message":"The plugin does not support options like failOnError (only 'warn' boolean).","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install flow-babel-webpack-plugin' (note: it's not 'flow-babel-webpack', missing hyphen).","cause":"Package not installed or typo in package name.","error":"Error: Cannot find module 'flow-babel-webpack-plugin'"},{"fix":"Use: const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin'); new FlowBabelWebpackPlugin();","cause":"Using import/require incorrectly; the plugin exports a single constructor, but attempting destructuring or using without 'new'.","error":"TypeError: FlowBabelWebpackPlugin is not a constructor"},{"fix":"Run 'npm install --save-dev babel-plugin-transform-flow-comments' and ensure .babelrc contains the plugin.","cause":"Missing babel-plugin-transform-flow-comments in devDependencies or .babelrc references it incorrectly.","error":"Module build failed: Error: Cannot find module 'babel-plugin-transform-flow-comments'"},{"fix":"Add 'flow-bin' as devDependency and run webpack from project root where node_modules/.bin is accessible.","cause":"Flow is not installed or not in PATH when webpack runs.","error":"flow: command not found"},{"fix":"Ensure flow-bin is installed: npm install --save-dev flow-bin; also check that 'flow' works from command line in project directory.","cause":"Flow binary not found or not executable.","error":"Unhandled 'error' event: Error: spawn flow ENOENT (or similar)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}