Registry / devops / flow-webpack-plugin

flow-webpack-plugin

JSON →
library1.2.0jsnpmunverified

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.

npm install flow-webpack-plugin
INSTALL
IMPORT
SIG · FLOW-WEBPACK-PLUGI
F
flow-webpack-plugin
devopsjavascriptv1.2.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FlowWebpackPlugin
✓ const FlowWebpackPlugin = require('flow-webpack-plugin')
✗ import FlowWebpackPlugin from 'flow-webpack-plugin'
The package does not provide ES module exports; CommonJS require is required. There is no default or named import.
FlowWebpackPlugin
✓ const FlowWebpackPlugin = require('flow-webpack-plugin')
✗ const { FlowWebpackPlugin } = require('flow-webpack-plugin')
The export is a single constructor function, not a named export. Destructuring will result in undefined.
Configuration options
✓ new FlowWebpackPlugin({ failOnError: true, flowPath: require('flow-bin') })
✗ new FlowWebpackPlugin({ failOnError: 'true' })
failOnError and failOnErrorWatch are boolean; passing string 'true' will be truthy but incorrect.

Example webpack configuration enabling Flow type-checking with error-on-fail settings.

const FlowWebpackPlugin = require('flow-webpack-plugin'); module.exports = { plugins: [ new FlowWebpackPlugin({ failOnError: true, failOnErrorWatch: false, reportingSeverity: 'error', printFlowOutput: true, flowPath: require.main.require('flow-bin'), flowArgs: ['--color=always'], verbose: false }), ], };
Debug
Known issues
gotchaflow-webpack-plugin does not provide ES module exports; attempting to import with ESM syntax will fail.
fix
Use CommonJS require: const FlowWebpackPlugin = require('flow-webpack-plugin');
affects: >=1.0.0
gotchaThe failOnError option defaults to false; flow errors will not cause webpack to exit with non-zero code unless explicitly set.
fix
Set failOnError: true in options to make webpack compilation fail on Flow errors.
affects: >=1.0.0
gotchaIf flow-bin is not installed, the plugin will throw unless flowPath option provides an alternative path.
fix
Ensure flow-bin is installed as a devDependency or provide a valid flowPath option.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: FlowWebpackPlugin is not a constructor
Using ES module import or destructuring require.
fix
Use const FlowWebpackPlugin = require('flow-webpack-plugin'); then new FlowWebpackPlugin(...)
Error: Cannot find module 'flow-bin'
flow-bin not installed and no flowPath option provided.
fix
Install flow-bin: npm install --save-dev flow-bin, or configure flowPath to a Flow binary.
Flow returned exit code X but webpack continues
failOnError or failOnErrorWatch not set to true.
fix
Set failOnError: true (or failOnErrorWatch: true for watch mode) in plugin options.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
flow-binoptionalFlow binary for type checking; not a hard dependency if flow is installed globally or via other means.
Agent activity
6 hits · last 30 days
node
6
Resources
flow-webpack-plugin — npm install flow-webpack-plugin · libregistry