If you set flowPath to a globally installed flow without any local flow, this plugin still throws an error like:
Error: `flow` can't be found. Please either install it (`npm install --save-dev flow-bin`) or set `flowPath` option
at FlowWebpackPluginError (.../flow-webpack-plugin/dist/index.js:262:1)
at getLocalFlowPath (.../flow-webpack-plugin/dist/index.js:200:28)
at applyOptionsDefaults (.../flow-webpack-plugin/dist/index.js:254:19)
at new FlowWebpackPlugin (.../flow-webpack-plugin/dist/index.js:27:20)
...
.
I'd expect to be able to direct the plugin to my global flow and for this to all work without any local flow install.
I think the reason that it fails is that applyOptionDefaults calls getLocalFlowPath too eagerly. That function throws the exception but is always called---even when a flowPath is provided. Instead, it should be a thunk or something analogous and only called if flowPath is missing.
If you set
flowPathto a globally installedflowwithout any localflow, this plugin still throws an error like:.
I'd expect to be able to direct the plugin to my global flow and for this to all work without any local
flowinstall.I think the reason that it fails is that
applyOptionDefaultscallsgetLocalFlowPathtoo eagerly. That function throws the exception but is always called---even when aflowPathis provided. Instead, it should be a thunk or something analogous and only called ifflowPathis missing.