Skip to main content

Babel

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 babel-plugin-syntax-hermes-parser with either Yarn or npm.

yarn add --dev @babel/preset-flow babel-plugin-syntax-hermes-parser
# or
npm install --save-dev @babel/preset-flow babel-plugin-syntax-hermes-parser

Then add the @babel/preset-flow preset and babel-plugin-syntax-hermes-parser plugin to your Babel config.

{
"presets": ["@babel/preset-flow"],
"plugins": ["babel-plugin-syntax-hermes-parser"],
}

You can read the documentation of babel-plugin-syntax-hermes-parser to see how to configure it. This website's Babel config provides an example with custom parser options.