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

module.name_mapper not working #7127

Closed
snownoop opened this issue Oct 31, 2018 · 2 comments
Closed

module.name_mapper not working #7127

snownoop opened this issue Oct 31, 2018 · 2 comments

Comments

@snownoop
Copy link

Hello. I have a problem with flow checking one of my webpack alias.

So i have something like:
config.resolve.alias['react-myLib'] = myLib/rslds/src
or
config.resolve.alias['react-myLib'] = myLib/rslds/lib
depending on env variable.

So i do imports inside my component files like this:
import { TableComponent } from 'react-myLib';

It is working fine but flow giving me an error:
Cannot resolve module react-myLib.

So i tried do this inside my .flowConfig:
module.name_mapper='^react-myLib\/\(.*\)$' -> 'empty/object'
but that didn't help.
I tried different regex and solutions but nothing worked for me.
Someone have an idea how to fix it ?

@bradennapier
Copy link

#7185

@Brianzchen
Copy link
Contributor

With module.name_mapper there are no builtin functions of objects. You're basically telling flow to redirect imports from one place to resolve from another. In your case, you're saying resolve from a library called empty instead of react-myLib. Do you have empty installed?

This is a common stack overflow post that people refer to but usually forget to actually import the empty lib
https://stackoverflow.com/a/41432015/13243085

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