1.0.3 • Published 8 years ago
flow-bin-loader v1.0.3
flow-bin-loader
A webpack loader built around flow-bin to enforce type checking with Flow.
Installation
$ npm install --save-dev flow-bin flow-bin-loaderUsage
Add the plugin to your webpack config as follows:
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'flow-bin-loader',
exclude: /node_modules/,
enforce: 'pre',
}
]
},Don't forget to add // @flow to the top of the files you want to be checked.
Configuration
By default, modules are resolved with respect to the directory where
.flowconfig lives, so you might need to tell Flow how to map paths to the
correct directory.
In order to do that, create a file named .flowconfig in the root directory
of your project and add a module mapper rule such as the one below.
[options]
module.name_mapper='^\(.*\)$' -> '<PROJECT_ROOT>/src/\1'For the complete list of options, visit https://flowtype.org/docs/advanced-configuration.html