zhirzh/flow-babel-webpack-plugin

Importance of transform-flow-comments

Closed this issue · 3 comments

First, thanks for writing/maintaining this awesome plugin!

Second, I'm wondering if using the transform-flow-comments plugin is absolutely necessary. My preference would be for the types to be stripped by Babel, but if I use transform-flow-comments, the commented types don't get stripped.

My app seems to be working just fine for now without using the additional plugin—Babel strips the type annotations and they don't show up in my source files or in my bundle. Do you expect that I'll run into major issues at some point if I don't use transform-flow-comments, or does it seem safe to go forward without it and re-introduce it if I run into any problems?

When used exclusively, both transform-flow-strip-types & transform-flow-comments work the same - remove flow annotations. I use TFC because if some other plugin or some service needs annotations also gets them since flow annotations also work from comments (see here).

In your specific case, it is possible that you are using some plugin (or the flow preset) that strips away the annotations.

Yes, I am using the flow preset to strip the type annotations. Thanks so much for your prompt reply and for maintaining this plugin!