website/docs/tools/babel.md
Flow and Babel are designed to work great together. It takes just a few steps to set them up together.
If you don't have Babel setup already, you can do that by following this guide.
Once you have Babel setup, install @babel/preset-flow and flow-parser with either
Yarn or npm.
yarn add --dev @babel/preset-flow flow-parser
# or
npm install --save-dev @babel/preset-flow flow-parser
Then add the @babel/preset-flow preset and flow-parser/babel-plugin plugin to your Babel config.
{
"presets": ["@babel/preset-flow"],
"plugins": ["flow-parser/babel-plugin"]
}
You can read the flow-parser Babel plugin documentation to see how to configure it, including custom parser options.