Skip to content

flowPath doesn't allow you to omit local flow #12

@colehaus

Description

@colehaus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions