{"id":25315,"library":"esbuild-plugin-babel-flow","title":"esbuild-plugin-babel-flow","description":"An esbuild plugin for stripping Flow type annotations from JavaScript files using Babel under the hood. Current version is 0.0.5, released as an early-stage package. It integrates into the esbuild plugin system via the 'onLoad' event, transforming code with Babel's transform API to remove Flow types for safe execution. Key differentiators: it bridges esbuild's lack of native Flow support by leveraging Babel's flow-strip-types preset. Alternative plugins exist (e.g., esbuild-plugin-flow), but this one explicitly uses Babel for compatibility. Note that peer dependency esbuild ^0.14.23 is required.","status":"active","version":"0.0.5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","esbuild","plugin","flow"],"install":[{"cmd":"npm install esbuild-plugin-babel-flow","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-babel-flow","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-babel-flow","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin runs in esbuild's build process.","package":"esbuild","optional":false}],"imports":[{"note":"The package uses a named export, not a default export. CommonJS require works: const { babelFlowPlugin } = require('esbuild-plugin-babel-flow')","wrong":"import babelFlowPlugin from 'esbuild-plugin-babel-flow'","symbol":"babelFlowPlugin","correct":"import { babelFlowPlugin } from 'esbuild-plugin-babel-flow'"},{"note":"Attempting a default import will result in undefined.","wrong":"import plugin from 'esbuild-plugin-babel-flow'","symbol":"default","correct":"There is no default export."},{"note":"TypeScript type import is safe; the package does not ship its own types, but you can declare or use Babel types.","wrong":"import { babelFlowPlugin } from 'esbuild-plugin-babel-flow' (if only type)","symbol":"babelFlowPlugin (type)","correct":"import type { babelFlowPlugin } from 'esbuild-plugin-babel-flow'"}],"quickstart":{"code":"import { build } from 'esbuild';\nimport { babelFlowPlugin } from 'esbuild-plugin-babel-flow';\n\nbuild({\n  entryPoints: ['example.flow.js'],\n  bundle: true,\n  outdir: 'dist',\n  plugins: [babelFlowPlugin()],\n}).catch(() => process.exit(1));\n// Ensure package.json has \"type\": \"module\" or use .mjs extension","lang":"javascript","description":"Demonstrates setting up esbuild with the Flow-stripping plugin, bundling a file with Flow type annotations."},"warnings":[{"fix":"Run flow check before or after bundling.","message":"Plugin does not perform type checking; it only strips types. Use Flow separately for type validation.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure esbuild version meets requirement.","message":"esbuild peer dependency must be ^0.14.23. Using other versions may cause incompatibility.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use esbuild's filter option to only apply plugin to files containing Flow annotations.","message":"The plugin applies Babel transformation to all loaded JS files, which may slow down builds for large codebases.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin version and monitor releases.","message":"No breaking changes documented as package is very early (v0.0.5). API subject to change.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install esbuild-plugin-babel-flow --save-dev","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'esbuild-plugin-babel-flow'"},{"fix":"Use import { build } from 'esbuild'","cause":"Incorrect esbuild import; common mistake importing default from esbuild.","error":"TypeError: esbuild.build is not a function"},{"fix":"Use import { babelFlowPlugin } from 'esbuild-plugin-babel-flow'","cause":"Using CommonJS require in an ES module package.json with \"type\": \"module\".","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}