{"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,"search_vec":"'0.0.5':25 '0.14.23':99 'altern':78 'annot':13 'api':50 'babel':4,18,47,71,91 'bridg':61 'code':45 'compat':93 'current':22 'depend':97 'differenti':59 'e.g':81 'earli':30 'early-stag':29 'esbuild':2,7,37,62,83,98,103 'esbuild-plugin-babel-flow':1 'esbuild-plugin-flow':82 'event':43 'execut':57 'exist':80 'explicit':89 'file':16 'flow':5,11,53,67,74,85,105 'flow-strip-typ':73 'hood':21 'integr':34 'javascript':15,102 'key':58 'lack':64 'leverag':70 'nativ':66 'note':94 'one':88 'onload':42 'packag':32 'peer':96 'plugin':3,8,38,79,84,104 'preset':77 'releas':26 'remov':52 'requir':101 'safe':56 'stage':31 'strip':10,75 'support':68 'system':39 'transform':44,49 'type':12,54,76 'use':17,90 'version':23 'via':40","created_at":"2026-05-01T13:44:07.638619+00:00","updated_at":"2026-05-01T13:44:07.638619+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/esbuild-plugin-babel-flow","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}