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

If a name_mapper points to a non-existent file, it should tell user that the mapped path doesn't exist (instead of the original path) #7427

Open
vjpr opened this issue Feb 1, 2019 · 4 comments

Comments

@vjpr
Copy link

vjpr commented Feb 1, 2019

module.name_mapper='.*\.css$' -> '<PROJECT_ROOT>/css-modules-stub.js.flow'
import foo from `foo.css`

Flow version: 0.91.

Expected behavior

Error should say:

Cannot find module 'foo.css' (after it was remapped to '<PROJECT_ROOT>/css-modules-stub.js.flow', check your .flowconfig mapper paths exist)

Actual behavior

Cannot find module 'foo.css' 

Related: #3889


Another example:

module.name_mapper='debug' -> 'empty/object'

If empty/object doesn't exist, there is no message to say that is the cause of Cannot resolve module 'debug' error.


There are many cases where name_mapper breaks things by the user wouldn't know. Try this to show the errors that are generated:

module.name_mapper='.*' -> '<PROJECT_ROOT>/some-empty-stub.js'

Then you get errors like this:

Cannot import Component because there is no Component export in react. Did you mean import Component from "..."?

But the cause is that the name_mapper has mapped to a file that doesn't export anything.

Related

@vicapow
Copy link
Contributor

vicapow commented Feb 1, 2019

Thanks for the report!

@ollelauribostrom
Copy link

I'd love to give this a shot (first contribution). Any pointers?

@goodmind
Copy link
Contributor

goodmind commented Aug 14, 2019

@ollelauribostrom are you still open to this?

@goodmind goodmind added the good first issue Good for newcomers label Aug 23, 2019
@code4cake
Copy link

code4cake commented Mar 10, 2020

@ollelauribostrom or @goodmind I can take it if it hasn't been done.

Could someone give me a pointer on how to best tackle this?

In the meantime, reading the contributing guidelines.

Thanks

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

5 participants