Flow loader for webpack
JavaScript
Switch branches/tags
Nothing to show
Clone or download
CodyReichert and torifat Bump webpack peerDependency (#13)
Allow webpack v3. I've been using this on v2 and v3 without any issues, so it should be good to go, but let me know if you need any other changes!

Fixes #12
Latest commit 7334a15 Dec 4, 2017

README.md

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})
  ]
  // ...
}