如何在项目中使用 flow js

1 安装依赖

   npm i  --save-dev babel-cli babel-preset-flow flow-babel-webpack-plugin


2 flow 配置初始化

    ./node_modules/.bin/flow init   

or

   flow init

3 配置 .babelrc 文件

   {
     "plugins" : [
       "transform-flow-comments"
     ]
   }

4 配置 webpack.config.js 文件

在文件中添加插件


   var FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');
   plugins: [
       new FlowBabelWebpackPlugin(),
   ],


完成

编辑于 2017-11-17