Create package.json
file
pnpm init -y
Install Babel and Flow bin
pnpm i -D @babel/{cli,core,preset-flow} flow-bin
Create .babelrc
file
{
"presets": ["@babel/preset-flow"]
}
Generate .flowconfig
file
pnpx flow init
Check flow error and status
pnpx flow status
Add compile on package.json
"scripts": {
"build": "babel src/ -d lib/"
},
add @flow
on Source file
main.js
// @flow
/**
* Code
*/
pnpm build