Skip to content

torifat/flowtype-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flowtype-loader

Flow loader for webpack

Install

$ npm install --save-dev flowtype-loader

OR, for lazy people like me:

$ npm i -D flowtype-loader

Usage

In your webpack 2.X configuration:

var FlowtypePlugin = require('flowtype-loader/plugin');

module.exports = {
  // ...
  module: {
    rules: [
      {test: /\.js$/, loader: 'flowtype-loader', enforce: 'pre', exclude: /node_modules/},
    ]
  },
  plugins: [
    new FlowtypePlugin()
    // new FlowtypePlugin({cwd: '/path/'})
    // new FlowtypePlugin({failOnError: true})
  ]
  // ...
}

If you are using webpack 1.x:

var FlowtypePlugin = require('flowtype-loader/plugin');

module.exports = {
  // ...
  module: {
    preLoaders: [
      {test: /\.js$/, loader: "flowtype", exclude: /node_modules/}
    ]
  },
  plugins: [
    new FlowtypePlugin()
    // new FlowtypePlugin({cwd: '/path/'})
    // new FlowtypePlugin({failOnError: true})
  ]
  // ...
}