Registry / web-framework / esbuild-plugin-flow

esbuild-plugin-flow

JSON →
library0.3.2jsnpmunverified

Esbuild plugin for stripping Flow type annotations using flow-remove-types. Current version 0.3.2 (latest). Installation requires direct GitHub URL. Designed for custom build scripts, not CLI. Key differentiator: integrates Flow type stripping into esbuild bundling. Alternatives like @babel/preset-flow require Babel; this plugin is lightweight. Entry point files are not processed (known limitation). Options include regex for file matching and optional force flag to strip even without @flow pragma.

npm install esbuild-plugin-flow
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-FLO
E
esbuild-plugin-flow
web-frameworkjavascriptv0.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

esbuild-plugin-flow
const flow = require('esbuild-plugin-flow')
import flow from 'esbuild-plugin-flow'
Package does not export ESM; CommonJS require is required.
default
const flow = require('esbuild-plugin-flow')
Default export is a function that returns a plugin.
flow (function)
flow(/regex/, false)
flow('regex')
First argument must be a RegExp object, not a string.

Basic usage: require the plugin, pass a RegExp matching .flow.js or .flow.jsx files, and include in esbuild plugins array.

const esbuild = require('esbuild'); const flow = require('esbuild-plugin-flow'); esbuild.build({ entryPoints: ['index.js'], outfile: 'dist/bundle.js', bundle: true, plugins: [flow(/\.flow\.jsx?$/)] }).catch(() => process.exit(1));
Debug
Known issues
breakingEntry point files are not processed by this plugin due to esbuild limitations; Flow types in entry point will not be stripped.
fix
Move entry point content into a non-entry module or use a separate build step for the entry file.
affects: >=0.0.0
gotchaInstallation requires GitHub URL, not npm registry. 'npm i --dev esbuild-plugin-flow' will fail.
fix
Install via: npm i --dev https://github.com/dalcib/esbuild-plugin-flow
affects: >=0.0.0
gotchaThe regex argument must be a RegExp object; passing a string will cause unexpected behavior.
fix
Pass a RegExp literal, e.g., /\.flow\.jsx?$/
affects: >=0.0.0
gotchaPlugin does not support ESM; using import syntax will fail.
fix
Use require('esbuild-plugin-flow') instead.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'esbuild-plugin-flow'
Package installed from GitHub URL, but Node.js module resolution may not find it if global symlinks are missing.
fix
Ensure you ran 'npm install https://github.com/dalcib/esbuild-plugin-flow' from the project root.
TypeError: flow is not a function
Using import instead of require, or not invoking the default export correctly.
fix
Use const flow = require('esbuild-plugin-flow'); flow(/regex/);
Error: The plugin must be a function or an object with a 'name' and 'setup' function.
Passing a string instead of a RegExp to the flow function, causing esbuild to receive an invalid plugin object.
fix
Ensure the argument to flow() is a RegExp, e.g., /\.flow\.jsx?$/
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
flow-remove-typesrequiredruntime dependency for stripping Flow type annotations
esbuildrequiredpeer dependency required for plugin integration
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-flow — npm install esbuild-plugin-flow · libregistry