DEV Community

takundanashebmuchena-pixel
takundanashebmuchena-pixel

Posted on

Fix: babel-plugin-transform-flow-strip-types broken in Babel 7 and 8

The original babel-plugin-transform-flow-strip-types hasn't been updated in 9 years and breaks silently in Babel 7 and 8 environments.

The fix

I published a maintained fork that works as a drop-in replacement:

npm install --save-dev babel-plugin-transform-flow-strip-types-maintained

Then update your .babelrc:

{
"plugins": ["transform-flow-strip-types-maintained"]
}

That's it. No other changes needed.

What's fixed

  • Babel 7 and 8 peer dependency conflicts
  • Missing syntax plugin declaration
  • Deprecated visitor patterns
  • allowDeclareFields support

Automated migration

If you want to update your entire project automatically:

npx flow-strip-migrate .

This updates your package.json and babel config in one command.

More info: https://flowstrip.netlify.app
npm: https://www.npmjs.com/package/babel-plugin-transform-flow-strip-types-maintained

Top comments (3)

Collapse
 
hayrullahkar profile image
Hayrullah Kar

Maintaining and patching 9-year-old silent breakages in core Babel tooling is heavy lifter work. The automated migration script is a brilliant touch for legacy codebases. Solid engineering!

Collapse
 
takundanashebmuchenapixel profile image
takundanashebmuchena-pixel

Thanks so much Hayrullah! Exactly right — legacy Flow codebases have been quietly suffering with this for years. The migration CLI was the piece I felt was missing most. If you ever run into edge cases or have suggestions, feel free to open an issue on GitHub. Happy to keep improving it!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.