Open jedwards1211 opened 6 years ago
More viable options:
Make it so that babel-plugin-flow-runtime
will avoid converting:
// flow-runtime no-convert
import type {Reducer} from 'redux'
ignorePackages
to plugin optionsAny type imports from ignored packages won't be converted.
{
"plugins": [
["flow-runtime", {"ignorePackages": ["redux"]}]
]
}
The best fix for this is via a custom webpack loader / plugin I think, we just need more information than a file-by-file approach can give us
That's true, but considering how much time that would take, would you accept a PR for option 3 or 4?
option 3 sounds like it would be the easiest to do,
// flow-runtime no-convert
import {Baz, type Foo} from 'bar'
should produce
import {Baz} from 'bar';
const Foo = t.any()
(yes would really appreciate a PR please!)
This is a:
Which concerns:
babel-plugin-flow-runtime
converts allimport type
statements to concrete imports, which causes Webpack 3 to warn about concrete imports which don't exist. The more suchimport type
statements, the more warnings, leading to a lot of noise.For example, if I
import type {Reducer} from 'redux'
, I get a warning like:How to solve this?
My
optInOnly
proposal would reduce the noise on this, though it wouldn't eliminate warnings in files where one opts in.Option 1
Get a PR into Webpack that allows us to put a comment before these imports that suppresses the warning, and then change
babel-plugin-flow-runtime
to insert the comments.Option 2
Look in the
node_modules
to see which imported types have corresponding concrete exports. Not a very good option I think.