{"id":20036,"library":"flow-webpack-plugin","title":"flow-webpack-plugin","description":"A webpack plugin that invokes the Flow type checker during each webpack compilation. Current version 1.2.0 is stable and actively maintained. It allows Webpack to exit with non-zero return codes if Flow validation fails, supports watch mode, and can reuse a project's existing flow-bin installation without requiring Flow to be on $PATH. Unlike per-file type-checkers, it runs Flow on the entire project.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/happylynx/flow-webpack-plugin","tags":["javascript","webpack","flow","plugin","flowtype"],"install":[{"cmd":"npm install flow-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add flow-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add flow-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Flow binary for type checking; not a hard dependency if flow is installed globally or via other means.","package":"flow-bin","optional":true}],"imports":[{"note":"The package does not provide ES module exports; CommonJS require is required. There is no default or named import.","wrong":"import FlowWebpackPlugin from 'flow-webpack-plugin'","symbol":"FlowWebpackPlugin","correct":"const FlowWebpackPlugin = require('flow-webpack-plugin')"},{"note":"The export is a single constructor function, not a named export. Destructuring will result in undefined.","wrong":"const { FlowWebpackPlugin } = require('flow-webpack-plugin')","symbol":"FlowWebpackPlugin","correct":"const FlowWebpackPlugin = require('flow-webpack-plugin')"},{"note":"failOnError and failOnErrorWatch are boolean; passing string 'true' will be truthy but incorrect.","wrong":"new FlowWebpackPlugin({ failOnError: 'true' })","symbol":"Configuration options","correct":"new FlowWebpackPlugin({ failOnError: true, flowPath: require('flow-bin') })"}],"quickstart":{"code":"const FlowWebpackPlugin = require('flow-webpack-plugin');\n\nmodule.exports = {\n  plugins: [\n    new FlowWebpackPlugin({\n      failOnError: true,\n      failOnErrorWatch: false,\n      reportingSeverity: 'error',\n      printFlowOutput: true,\n      flowPath: require.main.require('flow-bin'),\n      flowArgs: ['--color=always'],\n      verbose: false\n    }),\n  ],\n};","lang":"javascript","description":"Example webpack configuration enabling Flow type-checking with error-on-fail settings."},"warnings":[{"fix":"Use CommonJS require: const FlowWebpackPlugin = require('flow-webpack-plugin');","message":"flow-webpack-plugin does not provide ES module exports; attempting to import with ESM syntax will fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set failOnError: true in options to make webpack compilation fail on Flow errors.","message":"The failOnError option defaults to false; flow errors will not cause webpack to exit with non-zero code unless explicitly set.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure flow-bin is installed as a devDependency or provide a valid flowPath option.","message":"If flow-bin is not installed, the plugin will throw unless flowPath option provides an alternative path.","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":"Use const FlowWebpackPlugin = require('flow-webpack-plugin'); then new FlowWebpackPlugin(...)","cause":"Using ES module import or destructuring require.","error":"TypeError: FlowWebpackPlugin is not a constructor"},{"fix":"Install flow-bin: npm install --save-dev flow-bin, or configure flowPath to a Flow binary.","cause":"flow-bin not installed and no flowPath option provided.","error":"Error: Cannot find module 'flow-bin'"},{"fix":"Set failOnError: true (or failOnErrorWatch: true for watch mode) in plugin options.","cause":"failOnError or failOnErrorWatch not set to true.","error":"Flow returned exit code X but webpack continues"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}