Registry / serialization / babel-preset-flow

babel-preset-flow

JSON →
library6.23.0jsnpmunverified

Babel preset that strips Flow type annotations from JavaScript code. Contains babel-plugin-syntax-flow and babel-plugin-transform-flow-strip-types. Current stable version 6.23.0 (last published 2016-10-24); superseded by @babel/preset-flow in Babel 7. No releases since 2016. Use @babel/preset-flow for modern Babel 7+ projects.

npm install babel-preset-flow
INSTALL
IMPORT
SIG · BABEL-PRESET-FLOW
B
babel-preset-flow
serializationjavascriptv6.23.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
require('babel-preset-flow')
import babelPresetFlow from 'babel-preset-flow'
CJS-only; no default ESM export. In Node.js, use require.
plugins
require('babel-preset-flow').plugins
import('babel-preset-flow').then(m => m.plugins)
Dynamic import works but not recommended; the preset exports a plain object with a plugins array.

Shows how to configure babel-preset-flow in .babelrc and programmatically via babel-core to strip Flow type annotations.

// Install: npm install --save-dev babel-preset-flow // .babelrc { "presets": ["flow"] } // Or programmatically: const babel = require('babel-core'); babel.transform('type A = string; let a: A = "hello"; console.log(a);', { presets: ['flow'] }, (err, result) => { if (err) throw err; console.log(result.code); }); // Output: let a = "hello"; console.log(a);
Debug
Known issues
deprecatedbabel-preset-flow is deprecated in favor of @babel/preset-flow for Babel 7+.
fix
Replace with @babel/preset-flow and update to Babel 7+.
affects: >=6.0.0
breakingBabel 7 changed the plugin naming convention; babel-preset-flow is not compatible with Babel 7's @babel/core.
fix
Use @babel/preset-flow with Babel 7+.
affects: >=6.0.0 <7.0.0
gotchaThis preset only strips types; it does not parse all Flow features (e.g., Flow enums or opaque types may not be fully supported).
fix
Use a more recent version of @babel/preset-flow for better Flow coverage.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Plugin/Preset files are not allowed to export objects, only functions.
Using babel-preset-flow with Babel 7+ which expects @babel/preset-flow export format.
fix
Migrate to @babel/preset-flow for Babel 7+.
Module not found: Can't resolve 'babel-preset-flow' in '/path/to/project'
Missing dependency; babel-preset-flow is not installed.
fix
Run: npm install --save-dev babel-preset-flow
TypeError: this.addHelper is not a function
Incompatible Babel version; babel-preset-flow's internal plugins expect older Babel 6 helpers.
fix
Use @babel/preset-flow with Babel 7.
Upgrade
Version history
6.23.0latest on npm
Audit
Dependencies
babel-plugin-syntax-flowrequiredParsing flow syntax; included in preset but also a peer dependency of the transform plugin
babel-plugin-transform-flow-strip-typesrequiredStrips Flow types; core plugin of the preset
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources