Flow: Still Broken? module.system.node.resolve_dirname doesnt work

Created on 11 Dec 2017  路  8Comments  路  Source: facebook/flow

This has been reported a few times - figured it woudl have been fixed by now since its been broken for a long time now (version 58 i believe).

module.system.node.resolve_dirname will break Flow 100% and it stops reporting any/all errors in the project.

See #5225 #5180

Can we please get this looked into? It sucks to have to use relative urls for everything just to support this.

image

2 !== string

Most helpful comment

You should remove

module.system.node.resolve_dirname=./src

And add

module.name_mapper='^myModule/\(.*\)$' -> '<PROJECT_ROOT>/src/myModule/\1'

All 8 comments

Or in the minimum just remove it completely as a feature since its broken?

We were able to resolve this issue in our codebase by following the advice in https://github.com/facebook/flow/issues/5180#issuecomment-344226227

@bradennapier I can confirm this - still not working for me either. Even if I apply the suggested methods from #5180

It works, but not as you expect.

module.system.node.resolve_dirname marks a directorty as similar to node_modules.
Files in folders like this ignored by default if you don't use such files in your project (in some directory outside the node_modules and src if you marked src as resolve_dirname directory)

@apsavin ok, so considering the scenario that I want to resolve imports from inside source like

import myModule from 'myModule'

What steps would I have to take?
I already set module.system.node.resolve_dirname=./src, but this doesn't seem to help. Is there anything else I would have to do?

You should remove

module.system.node.resolve_dirname=./src

And add

module.name_mapper='^myModule/\(.*\)$' -> '<PROJECT_ROOT>/src/myModule/\1'

@apsavin Ah thanks - that works. It's a bit unwiedly, but at least now we can update our Apps. Thanks! :)

This probably can be closed.
/cc @vkurchatkin

Was this page helpful?
0 / 5 - 0 ratings