gajus / gajus/flow-runtime

Webpack 3 warns about missing imports from flow-runtime conversion

Open
#179 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
797
Forks
49
PR merge metrics
No merged PRs in 30d

Description

This is a:

- [x] Bug Report
- [ ] Feature Request
- [ ] Question
- [ ] Other

Which concerns:

- [ ] flow-runtime
- [x] babel-plugin-flow-runtime
- [ ] flow-runtime-validators
- [ ] flow-runtime-mobx
- [ ] flow-config-parser
- [ ] The documentation website

`babel-plugin-flow-runtime` converts all `import type` statements to concrete imports, which
causes Webpack 3 to warn about concrete imports which don't exist. The more such `import 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:

```
WARNING in ./src/universal/redux/types.js
155:9-18 "export 'Reducer' (imported as '_Reducer2') was not found in 'redux'
@ ./src/universal/redux/types.js
@ ./src/client/index.js
@ multi babel-polyfill react-hot-loader/patch ./src/client/index.js webpack-hot-middleware/client
```

### How to solve this?

My [`optInOnly` proposal](https://github.com/codemix/flow-runtime/pull/166) 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.