Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no autocomplete or type-hints for module.name_mapper #5883

Closed
allesklarbeidir opened this issue Feb 27, 2018 · 2 comments
Closed

no autocomplete or type-hints for module.name_mapper #5883

allesklarbeidir opened this issue Feb 27, 2018 · 2 comments

Comments

@allesklarbeidir
Copy link

Hi,

I'm running into a problem when using the .flowconfig option "module.name_mapper".
I've read multiple other issue tickets on problems that module.name_mapper won't find a module etc. but my problem is different.
Flow doesn't throw an error and it looks like it could resolve the module name using the definded mappings.

But: When importing modules that have been mapped with webpack alias and flow's module.name_mapper option, I won't get any autocompletion or type hints anymore.
I'm using the flowtype vscode plugin but I also tried getting the autocompletion output directly from the cli flow-bin but the output is empty.

My directory structure looks like the following:

  • _src
    • _shared
      • elements
        • SomeComponentName
          • index.js
    • backend
      • ...
        • SomeOtherComponentName
          • index.js
    • frontend
      • ...
        • AnotherComponentName
          • index.js

So the situation is, that the backend and the frontend need to share some react components.

Now I've set up my .flowconfig:

[ignore]

[include]

[libs]

[lints]

[options]

; Extensions
; Map aliases
module.name_mapper='^shared/\(.*?\)' ->'<PROJECT_ROOT>/_src/_shared/\1'
module.name_mapper='^elements/\(.*?\)' ->'<PROJECT_ROOT>/_src/_shared/elements/\1'

[strict]

So that I can use an import statement:

import FAIcon from "elements/FAIcon";

Which works and doesn't throw an flow error or anything else. It compiles fine with webpack and everything is working but I'm now missing all the great features like type hints and autocompletion.

Is there a way for me to change some configurations in order to make it work?

Thanks in advance!

@wilsonshakespeare
Copy link

UP! I'm also facing this similar problem

@SamChou19815
Copy link
Contributor

It should have been fixed a long time ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants